Spaces:
Runtime error
Runtime error
Commit ·
e0a6772
1
Parent(s): 60a45cd
Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastai.vision.all import *
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
learn = load_learner('construction_things.pkl')
|
| 5 |
+
|
| 6 |
+
def classify_image(img):
|
| 7 |
+
pred,idx,probs = learn.predict(img)
|
| 8 |
+
return dict(zip(dls.vocab,map(float,probs)))
|
| 9 |
+
|
| 10 |
+
image = gr.inputs.Image(shape=(192,192))
|
| 11 |
+
label = gr.outputs.Label()
|
| 12 |
+
interface = gr.Interface(fn=classify_image,inputs=image,outputs=label)
|
| 13 |
+
# interface.launch(inline=True)
|
| 14 |
+
interface.launch(inline=False)
|