Spaces:
Runtime error
Runtime error
Commit
·
98d9515
1
Parent(s):
26ee1d1
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import os
|
| 3 |
+
from fastai.vision.all import load_learner
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
model = load_learner("model.pkl")
|
| 7 |
+
prediction, idx, confidence = model.predict(image)
|
| 8 |
+
|
| 9 |
+
model = load_learner("model.pkl")
|
| 10 |
+
|
| 11 |
+
def predict(img):
|
| 12 |
+
pred, idx, probs = model.predict(img)
|
| 13 |
+
model = load_learner("model.pkl")
|
| 14 |
+
prediction, idx, confidence = model.predict(image)
|
| 15 |
+
return prediction
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
image = gr.inputs.Image(shape=(256, 256))
|
| 19 |
+
label = gr.outputs.Label()
|
| 20 |
+
|
| 21 |
+
interface = gr.Interface(fn=predict, inputs=image, outputs=label)
|
| 22 |
+
interface.launch()
|