Anders Dahlen commited on
Commit
ed2a592
·
1 Parent(s): d6d2c99

adding model and trying to make somethiugn work

Browse files
Files changed (2) hide show
  1. app.py +8 -4
  2. model.pkl +3 -0
app.py CHANGED
@@ -1,7 +1,11 @@
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
 
4
+ learn = load_learner('model.pkl')
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
+ gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:75c2bb6d419be2b23b78ebac686d33401683fb000a4a89aceb3b9e2cd13771f2
3
+ size 47065195