thewillofdee commited on
Commit
a2bfdc0
·
1 Parent(s): 7737ef0

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import gradio as gr
3
+ from Ipython.display import Image
4
+ from Ipython.core.display import HTML
5
+ import skimage
6
+ from PIL import Image as PILImage
7
+
8
+ learn = load_learner("export.pkl")
9
+
10
+ labels = learner.dls.vocab
11
+ def predict(img):
12
+ img = PILImage.create(img)
13
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
14
+
15
+ gr.Interface(fn=predict, inputs=inpts.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)