Jamin252 commited on
Commit
ce43a90
·
1 Parent(s): 542a1c1

Add predict

Browse files
Files changed (1) hide show
  1. app.py +15 -15
app.py CHANGED
@@ -1,19 +1,19 @@
1
- # import gradio as gr
2
- # from fastai.vision.all import *
3
- # learn = load_learner(" dogIdentifier.pkl")
4
- # labels = learn.dls.vocab
5
- # def predict(img):
6
- # img = PILImage.create(img)
7
- # pred,pred_idx,probs = learn.predict(img)
8
- # return {labels[i]: float(probs[i]) for i in range(len(labels))}
9
 
10
- # iface = gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3))
11
- # iface.launch()
12
 
13
- import gradio as gr
14
 
15
- def greet(name):
16
- return "Hello " + name + "!!"
17
 
18
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
19
- iface.launch()
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+ learn = load_learner(" dogIdentifier.pkl")
4
+ labels = learn.dls.vocab
5
+ def predict(img):
6
+ img = PILImage.create(img)
7
+ pred,pred_idx,probs = learn.predict(img)
8
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
9
 
10
+ iface = gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3))
11
+ iface.launch()
12
 
13
+ # import gradio as gr
14
 
15
+ # def greet(name):
16
+ # return "Hello " + name + "!!"
17
 
18
+ # iface = gr.Interface(fn=greet, inputs="text", outputs="text")
19
+ # iface.launch()