Spaces:
Build error
Build error
JP Hwang
commited on
Commit
·
2f27cb3
1
Parent(s):
a24e8a8
added app
Browse files- app.py +16 -0
- architecture.pkl +3 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
+
from fastcore import *
|
3 |
+
learn = load_learner('architecture.pkl')
|
4 |
+
labels = learn.dls.vocab
|
5 |
+
|
6 |
+
def predict(imgpath):
|
7 |
+
img = PILImage.create(imgpath)
|
8 |
+
pred, pred_idx, probs = learn.predict(img)
|
9 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
10 |
+
|
11 |
+
import gradio as gr
|
12 |
+
gr.Interface(
|
13 |
+
fn=predict,
|
14 |
+
inputs=gr.inputs.Image(shape=(512, 512)),
|
15 |
+
outputs=gr.outputs.Label(num_top_classes=3)
|
16 |
+
).launch(share=True)
|
architecture.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b8428f71bbb7810c7a924e00c688fb104d12e143906ba768aa7e52674783d588
|
3 |
+
size 87675873
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
gradio
|