tddy
Browse files
app.py
CHANGED
@@ -1,18 +1,16 @@
|
|
1 |
import gradio as gr
|
2 |
from fastai.vision.all import *
|
3 |
|
4 |
-
def is_cat(x): return x[0].is_upper()
|
5 |
-
|
6 |
|
7 |
learn = load_learner('model.pkl')
|
8 |
|
9 |
-
categories = (
|
10 |
|
11 |
def classify_image(img):
|
12 |
prob, idx, probs = learn.predict(img)
|
13 |
return dict(zip(categories, map(float, probs)))
|
14 |
|
15 |
-
examples = []
|
16 |
|
17 |
iface = gr.Interface(fn=classify_image, inputs=gr.Image(type="pil"), outputs=gr.Label(num_top_classes=2), examples = examples)
|
18 |
iface.launch(inline=False)
|
|
|
1 |
import gradio as gr
|
2 |
from fastai.vision.all import *
|
3 |
|
|
|
|
|
4 |
|
5 |
learn = load_learner('model.pkl')
|
6 |
|
7 |
+
categories = ('black','grizzly','teddy')
|
8 |
|
9 |
def classify_image(img):
|
10 |
prob, idx, probs = learn.predict(img)
|
11 |
return dict(zip(categories, map(float, probs)))
|
12 |
|
13 |
+
examples = ['ted.jpeg']
|
14 |
|
15 |
iface = gr.Interface(fn=classify_image, inputs=gr.Image(type="pil"), outputs=gr.Label(num_top_classes=2), examples = examples)
|
16 |
iface.launch(inline=False)
|
ted.jpeg
ADDED