moro23 commited on
Commit
2c7539c
·
1 Parent(s): dc8666f

Added application file

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastbook import *
2
+ import gradio as gr
3
+
4
+ ## lets load the model
5
+ learn_inf = load_learner(path/'bear_classifier_cat')
6
+
7
+ def bear_classifier(image):
8
+ pred,pred_idx,probs = learn_inf.predict(image)
9
+ pred_name = f'Prediction: {pred}'
10
+ pred_prob = f'Probability: {probs[pred_idx]:.04f}'
11
+ return image, pred_name, pred_prob
12
+
13
+
14
+ iface = gr.Interface(fn=bear_classifier, inputs=gr.inputs.Image(shape=(224, 224)), \
15
+ outputs=["text", "number"])
16
+
17
+ iface.launch(inline=False)