Spaces:
Runtime error
Runtime error
init
Browse files
README.md
CHANGED
@@ -1,12 +1,37 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# CycleGAN Gradio Web App deployed on Heroku
|
2 |
+
|
3 |
+
This folder contains code to deploy a simple Horse-to-Zebra model onto Heroku for free.
|
4 |
+
|
5 |
+
An example web app is running at:
|
6 |
+
http://upit-cyclegan.herokuapp.com/
|
7 |
+
|
8 |
+
Note: it takes a couple minutes for the web app to load and a few seconds to produce a result. Upgrading to paid web apps (dynos) may alleviate some of these issues.
|
9 |
+
|
10 |
+
## How to deploy:
|
11 |
+
|
12 |
+
1. Install the [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli#download-and-install)
|
13 |
+
2. Clone this repository:
|
14 |
+
```
|
15 |
+
git clone https://github.com/tmabraham/UPIT.git
|
16 |
+
```
|
17 |
+
3. Initialize a Heroku web app from the command line (in the UPIT repository folder):
|
18 |
+
```
|
19 |
+
heroku create
|
20 |
+
```
|
21 |
+
4. Deploy the `web_app` folder
|
22 |
+
```
|
23 |
+
git subtree push --prefix examples/web_app heroku master
|
24 |
+
```
|
25 |
+
And that's it! Heroku will process the code, compress it and deploy it, providing you with a link you can visit at any time!
|
26 |
+
|
27 |
+
This deployment was based on [this guide](https://towardsdatascience.com/how-to-deploy-a-machine-learning-ui-on-heroku-in-5-steps-b8cd3c9208e6).
|
28 |
+
|
29 |
+
## File descriptions:
|
30 |
+
|
31 |
+
`cyclegan_inference.ipynb` - This is a notebook with all the code to run a Gradio web app demo. Running this notebook will yield in a temporary temporary web app that is not persistent (runs for 6 hours). The `gradio.app` link is provided after running the code. Also note that this code is set up to run on the GPU. This can be easily changed by changing the `map_location` in `torch.load`.
|
32 |
+
|
33 |
+
`cyclegan_inference.py` - This is a Python file version of `cyclegan_inference.ipynb` that runs on the CPU and takes in 256x256 images (due to low memory for free Heroku dyno). This is what is used for the Heroku deployment.
|
34 |
+
|
35 |
+
`generator.pth` - My model file saved with the UPIT `export_generator` function. You can replace with your own generator.
|
36 |
+
|
37 |
+
`Procfile`,`requirements.txt`,`runtime.txt`,`setup.sh` - These files are required for Heroku deployment.
|