using model
Browse files
app.py
CHANGED
@@ -1,7 +1,16 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|