A web app to generate template code for machine learning.

Generate custom template code for PyTorch & sklearn, using a simple web UI built with streamlit. traingenerator offers multiple options for preprocessing, model setup, training, and visualization (using Tensorboard or It exports to .py, Jupyter Notebook, or Google Colab. The perfect tool to jumpstart your next machine learning project!



git clone
cd traingenerator
pip install -r requirements.txt

Optional: For the "Open in Colab" button to work you need to set up a Github repo
where the notebook files can be stored (Colab can only open public files if
they are on Github). After setting up the repo, create a file .env with content:


If you don't set this up, the app will still work but the "Open in Colab" button
will only show an error message.

Running locally

streamlit run app/

Make sure to run always from the traingenerator dir (not from the app dir),
otherwise the app will not be able to find the templates.

Deploying to Heroku

First, install heroku and login.
To create a new deployment, run inside traingenerator:

heroku create
git push heroku main
heroku open

To update the deployed app, commit your changes and run:

git push heroku main

Optional: If you set up a Github repo to enable the "Open in Colab" button (see above),
you also need to run:

heroku config:set GITHUB_TOKEN=<your-github-access-token>
heroku config:set REPO_NAME=<user/notebooks-repo>


pytest ./tests

This generates Python codes with different configurations (just like the app would do)
and checks that they run. The streamlit app itself is not tested at the moment.