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