gradio/Test Keras.ipynb
2019-04-18 20:18:56 -07:00

3.1 KiB

Load the Model

In [5]:
%load_ext autoreload
%autoreload 2

import numpy as np
import tensorflow as tf
import gradio
The autoreload extension is already loaded. To reload it, use:
  %reload_ext autoreload
In [6]:
model = tf.keras.applications.inception_v3.InceptionV3()

Using Gradio

In [7]:
inp = gradio.inputs.ImageUpload(shape=(299,299,3))
out = gradio.outputs.Label(label_names='imagenet1000', max_label_length=8)

io = gradio.Interface(inputs=inp, 
                      outputs=out,
                      model=model, 
                      model_type='keras')
In [14]:
io.launch(inline=True, inbrowser=False, share=True, validate=False)
;
Closing existing server...
NOTE: Gradio is in beta stage, please report all bugs to: contact.gradio@gmail.com
Model is running locally at: http://localhost:7861/
Unable to create public link for interface, please check internet connection or try restarting python interpreter.
Out[14]:
''
In [ ]: