tristan k
commited on
Commit
·
614f529
1
Parent(s):
406c77c
update to bear predictor
Browse files
app.py
CHANGED
@@ -1,7 +1,18 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
import fastbook
|
3 |
|
4 |
+
fastbook.setup_book()
|
|
|
5 |
|
6 |
+
from fastbook import *
|
7 |
+
from fastai.vision.widgets import *
|
8 |
+
|
9 |
+
learn = load_learner('bear_model.pkl')
|
10 |
+
|
11 |
+
categories = ("black", "grizzly", "teddy")
|
12 |
+
|
13 |
+
def classify_image(img):
|
14 |
+
pred,idx,probs = learn.predict(img)
|
15 |
+
return dict(zip(categories, map(float, probs)))
|
16 |
+
|
17 |
+
demo = gr.Interface(fn=classify_image, inputs="image", outputs="label")
|
18 |
demo.launch()
|