Spaces:
Runtime error
Runtime error
raahimsal
commited on
Commit
•
cdf1691
1
Parent(s):
657cf07
+ model
Browse files
app.py
CHANGED
@@ -1,7 +1,22 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
def greet(name):
|
4 |
return "Hello " + name + "!!"
|
5 |
|
6 |
-
iface = gr.Interface(fn=
|
7 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from fastai.vision.widgets import *
|
3 |
+
from fastbook import *
|
4 |
+
|
5 |
+
learn = load_learner(r"fastbook/export.pkl")
|
6 |
+
|
7 |
+
categories = ('Grizzly','Black','Teddy')
|
8 |
+
|
9 |
+
def classify_images(img):
|
10 |
+
pred,idx,probs = learn.predict(img)
|
11 |
+
return dict(zip(categories, map(float, probs)))
|
12 |
+
|
13 |
+
image = gr.inputs.Image(shape=(192,192))
|
14 |
+
label = gr.outputs.Label()
|
15 |
+
examples = ['fastbook/bears/black/0d147856-6c48-449c-80a1-8ea58587d207.jpg']
|
16 |
+
|
17 |
|
18 |
def greet(name):
|
19 |
return "Hello " + name + "!!"
|
20 |
|
21 |
+
iface = gr.Interface(fn=classify_images, inputs=image, outputs=label, examples=examples)
|
22 |
iface.launch()
|