Spaces:
Runtime error
Runtime error
Commit ·
cf6e1a5
1
Parent(s): e4de50e
model
Browse files- app.py +19 -0
- model.pkl +3 -0
- requirements.txt +1 -0
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastai.vision.all import *
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
learn = load_learner("model.pkl")
|
| 6 |
+
|
| 7 |
+
categories = ('Guitar','Piano')
|
| 8 |
+
|
| 9 |
+
def classify_image(image):
|
| 10 |
+
outcome,idx,probs = learn.predict(image)
|
| 11 |
+
return dict(zip(categories,map(float,probs)))
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
iface = gr.Interface(
|
| 15 |
+
fn = classify_image,
|
| 16 |
+
inputs = "image",
|
| 17 |
+
outputs = gr.outputs.Label()
|
| 18 |
+
)
|
| 19 |
+
iface.launch()
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9e2a6b907c3a77173f22313d3006bff873c55848ab52afa76230817922334411
|
| 3 |
+
size 46953617
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
fastai==2.7.10
|