CullerWhale commited on
Commit
1ba40d5
·
1 Parent(s): e2129cc
Files changed (2) hide show
  1. app.py +14 -2
  2. export.pkl +3 -0
app.py CHANGED
@@ -1,7 +1,19 @@
1
  import gradio as gr
2
 
 
 
 
 
 
 
 
 
 
3
  def greet(name):
4
  return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
1
  import gradio as gr
2
 
3
+ learn = load_learner('export.pkl')
4
+
5
+ labels = learn.dls.vocab
6
+ def predict(img):
7
+ img = PILImage.create(img)
8
+ pred,pred_idx,probs = learn.predict(img)
9
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
10
+
11
+
12
  def greet(name):
13
  return "Hello " + name + "!!"
14
 
15
+
16
+
17
+ # iface = gr.Interface(fn=greet, inputs="text", outputs="text")
18
+ # iface.launch()
19
+ iface = gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
export.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c0e092718c80e67ba532689c3ba780f4e4ffba30a850187f388e7f16bfc195da
3
+ size 47019190