Spaces:
Sleeping
Sleeping
jerryjia92
commited on
Commit
•
022e9c5
1
Parent(s):
73f728d
update
Browse files- Abyssinian_17.jpg +0 -0
- app.py +7 -1
- yorkshire_terrier_171.jpg +0 -0
Abyssinian_17.jpg
ADDED
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
from fastai.vision.all import *
|
2 |
import gradio as gr
|
|
|
3 |
|
4 |
def is_cat(x):
|
5 |
return 'cat' if (x.name)[0].isupper() else 'dog'
|
@@ -13,4 +14,9 @@ def predict(img):
|
|
13 |
pred,pred_idx,probs = learn.predict(img)
|
14 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
15 |
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
+
import timm
|
4 |
|
5 |
def is_cat(x):
|
6 |
return 'cat' if (x.name)[0].isupper() else 'dog'
|
|
|
14 |
pred,pred_idx,probs = learn.predict(img)
|
15 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
16 |
|
17 |
+
image = gr.Image()
|
18 |
+
label = gr.Label()
|
19 |
+
examples = ['yorkshire_terrier_171.jpg','Abyssinian_17.jpg']
|
20 |
+
|
21 |
+
intf = gr.Interface(fn=predict, inputs=image, outputs=label, examples=examples)
|
22 |
+
intf.launch()
|
yorkshire_terrier_171.jpg
ADDED