Best way to transform Jupyter notebook code in a web app

Viewed 115

Suppose, I have a Jupyter notebook that contains the code of Image Captioning. Let's say this is our example notebook. This is a simple machine learning model where the workflow is like loading the data, training the model, and using the model to predict the caption for any image.

What I want to learn is how to make a simple publicly available web app (like this) where the users can just upload their image or provide a link to their image and get the required captions as output.

1 Answers

You can try to use Mercury. It tranforms Jupyter notebooks into web app by adding YAML header in the first raw cell in the notebook. You can easily define an image upload as input. Example YAML config:

title: App title
description: App description
params:
    my_image:
        input: file
        label: Please upload image
        maxFileSize: 1MB

In the next cell you need to define variable with file name

my_image = "my_image.png"

In the rest cells you should have your notebooks cells.

Related