Spaces:
Sleeping
Sleeping
Jonathan Chen
commited on
Commit
•
db3fa72
1
Parent(s):
2716603
use catdog model
Browse files
app.py
CHANGED
@@ -1,7 +1,10 @@
|
|
1 |
-
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
|
|
|
1 |
+
learn = load_learner('model.pkl')
|
2 |
|
3 |
+
labels = learn.dls.vocab
|
4 |
+
def predict(img):
|
5 |
+
img = PILImage.create(img)
|
6 |
+
pred,pred_idx,probs = learn.predict(img)
|
7 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
8 |
|
9 |
+
import gradio as gr
|
10 |
+
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
|
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bc4b39d525e1cbbb9e4925aec48d822c489e69d80f074e1b0dc7c7d32bc5caec
|
3 |
+
size 47061419
|