Spaces:
Sleeping
Sleeping
jerryjia92
commited on
Commit
•
2acfbe4
1
Parent(s):
cfc1b06
version 1
Browse files- app.py +10 -4
- export.pkl +3 -0
app.py
CHANGED
@@ -1,7 +1,13 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
|
4 |
+
learn = load_learner('export.pkl')
|
|
|
5 |
|
6 |
+
labels = learn.dls.vocab
|
7 |
+
|
8 |
+
def predict(img):
|
9 |
+
img = PILImage.create(img)
|
10 |
+
pred,pred_idx,probs = learn.predict(img)
|
11 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
12 |
+
|
13 |
+
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(224, 224)), outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
|
export.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ed3aaf8d9fb95f8f111ec9de1d8e78d6f616fe5a5b162088dc24099de3a92286
|
3 |
+
size 47049374
|