Spaces:
Runtime error
Runtime error
Commit
·
e34d20e
1
Parent(s):
e8f91f7
yes
Browse files
app.py
CHANGED
|
@@ -10,12 +10,15 @@ import gradio as gr
|
|
| 10 |
|
| 11 |
learn = load_learner(Path("model.pkl"))
|
| 12 |
|
| 13 |
-
categories = {'
|
| 14 |
|
| 15 |
def classify_image(img):
|
| 16 |
pred, idx, probs = learn.predict(img)
|
| 17 |
-
print(
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
|
| 21 |
image = gr.Image(shape=(192, 192))
|
|
@@ -24,6 +27,6 @@ examples = ['pizza.jpg', 'pasta.jpg', 'dunno.jpg']
|
|
| 24 |
|
| 25 |
app = gr.Interface(fn=classify_image,
|
| 26 |
inputs=image,
|
| 27 |
-
outputs=label,
|
| 28 |
examples=examples)
|
| 29 |
app.launch()
|
|
|
|
| 10 |
|
| 11 |
learn = load_learner(Path("model.pkl"))
|
| 12 |
|
| 13 |
+
# categories = {'Pizza', 'Pasta'}
|
| 14 |
|
| 15 |
def classify_image(img):
|
| 16 |
pred, idx, probs = learn.predict(img)
|
| 17 |
+
# print(pred)
|
| 18 |
+
# print(idx)
|
| 19 |
+
# print(dict(zip(categories, map(float, probs))))
|
| 20 |
+
return f"This is {pred}.\nConfidence Level: {float(max(probs))}"
|
| 21 |
+
# return dict(zip(categories, map(float, probs)))
|
| 22 |
|
| 23 |
|
| 24 |
image = gr.Image(shape=(192, 192))
|
|
|
|
| 27 |
|
| 28 |
app = gr.Interface(fn=classify_image,
|
| 29 |
inputs=image,
|
| 30 |
+
outputs=gr.Textbox(label="Output"),
|
| 31 |
examples=examples)
|
| 32 |
app.launch()
|