Spaces:
Runtime error
Runtime error
kb commited on
Commit ·
daa6894
1
Parent(s): 417f037
change code of app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
import fastai
|
| 2 |
from fastai.vision.all import *
|
| 3 |
import gradio as gr
|
| 4 |
|
|
@@ -12,10 +11,9 @@ def classify_image(img):
|
|
| 12 |
pred,idx,probs =learn.predict(img)
|
| 13 |
return dict(zip(categories, map(float,probs)))
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
outputs=gr.Label(num_top_classes=3),
|
| 19 |
-
)
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
|
|
| 1 |
from fastai.vision.all import *
|
| 2 |
import gradio as gr
|
| 3 |
|
|
|
|
| 11 |
pred,idx,probs =learn.predict(img)
|
| 12 |
return dict(zip(categories, map(float,probs)))
|
| 13 |
|
| 14 |
+
image = gr.Image(shape=(192, 192))
|
| 15 |
+
label = gr.Label()
|
| 16 |
+
examples = ['dog.jpg', 'cat.jpg', 'dunno.jpg']
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 19 |
+
intf.launch(inline=False)
|