zhongdj commited on
Commit
7ec7dca
·
1 Parent(s): 86e2ff2

using model

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -1,7 +1,16 @@
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
+ import fastbook
4
+ fastbook.setup_book()
5
+ from fastbook import *
6
+ from fastai.vision.widgets import *
7
 
8
+ f = Path() / 'bamboo_or_butterfly.pkl'
9
+ learn_inf = load_learner(f)
10
+
11
+ def predict(img)
12
+ pred, pred_idx, probs = learn_inf.predict(img.to_thumb(224))
13
+ f'Prediction: {pred}; Probability:{probs[pred_idx]:.04f}'
14
+
15
+ iface = gr.Interface(fn=predict, inputs="image", outputs="text")
16
  iface.launch()