> For the complete documentation index, see [llms.txt](https://medomicslab.gitbook.io/mediml-app-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://medomicslab.gitbook.io/mediml-app-docs/code-generation.md).

# Code generation

The code generation feature in the learning module allows users to generate Python code for their experiments with a simple click. This feature enables users to make in-depth changes to the experiment code, share it with other computer scientists, and navigate seamlessly between the user interface and the code base.&#x20;

After running one or multiple experiment pipelines, follow the instructions below to generate the code for a given pipeline.

* Open the results panel:

<figure><img src="/files/aKaLmyO8OqCIbZT0aaVi" alt=""><figcaption></figcaption></figure>

* Click the *Generate* button to select your pipelines for code generation:

<figure><img src="/files/HwgcGN1shf1rHkVT1aHd" alt=""><figcaption></figcaption></figure>

* Select the pipelines

<figure><img src="/files/O2ZJqFIthSfVMeOOKl0s" alt=""><figcaption></figcaption></figure>

* Click generation:

<figure><img src="/files/ORpBYIgUZFgkh2L1KtGP" alt=""><figcaption></figcaption></figure>

Consequently, a[ *juypter notebook*](https://jupyter.org/) will automatically open with the generated code:

<figure><img src="/files/uXQ1xNMPnLMzjcgJrVXo" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
In most cases, you need to select the appropriate kernel before running the Jupyter notebook. Follow the instructions below to do so.
{% endhint %}

### Selecting the kernel for your generated code

* Click kernel
* Change kernel
* Select: *med\_conda\_env*
* The selected kernel's name must appear on the top right

<figure><img src="/files/snFwtuRNuiLaVnkOuq8m" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
If *med\_conda\_env* kernel is missing from your kernel's list.  Follow the instructions below to add it.
{% endhint %}

Add your *med\_conda\_env* to your kernel's list by running the following two commands:

```
conda activate med_conda_env
python -m ipykernel install --user --name=med_conda_env
```

Please feel free to [contact us](/mediml-app-docs/forms/contact-us.md) if you need any further assistance :innocent:.
