Spaces:
Runtime error
Runtime error
David Hrachovy commited on
Commit ·
22a7620
1
Parent(s): 566a14d
nice interface
Browse files- README.md +3 -3
- app.py +8 -2
- battle.jpg +0 -0
- pic.jpg +0 -0
- requirements.txt +2 -1
README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
---
|
| 2 |
title: Fastai
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 3.1.1
|
| 8 |
app_file: app.py
|
|
|
|
| 1 |
---
|
| 2 |
title: Fastai
|
| 3 |
+
emoji: 🐸
|
| 4 |
+
colorFrom: yellow
|
| 5 |
+
colorTo: green
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 3.1.1
|
| 8 |
app_file: app.py
|
app.py
CHANGED
|
@@ -3,11 +3,17 @@ import gradio as gr
|
|
| 3 |
|
| 4 |
learn = load_learner('export.pkl')
|
| 5 |
|
| 6 |
-
labels =
|
| 7 |
|
| 8 |
def predict(img):
|
| 9 |
img = PILImage.create(img)
|
| 10 |
pred,pred_idx,probs = learn.predict(img)
|
| 11 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
learn = load_learner('export.pkl')
|
| 5 |
|
| 6 |
+
labels = ["This is Battletoads!", "Not Battletoads"]
|
| 7 |
|
| 8 |
def predict(img):
|
| 9 |
img = PILImage.create(img)
|
| 10 |
pred,pred_idx,probs = learn.predict(img)
|
| 11 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 12 |
|
| 13 |
+
title = "Is it Battletoads game?"
|
| 14 |
+
description = '<img src="https://huggingface.co/spaces/HuggingDavid/battletoads/resolve/main/pic.jpg" alt="rick" width="200"/>'
|
| 15 |
+
examples = ['battle.jpg']
|
| 16 |
+
interpretation='default'
|
| 17 |
+
enable_queue=True
|
| 18 |
+
|
| 19 |
+
gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=3),title=title,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch()
|
battle.jpg
CHANGED
|
|
pic.jpg
ADDED
|
requirements.txt
CHANGED
|
@@ -1 +1,2 @@
|
|
| 1 |
-
fastai
|
|
|
|
|
|
| 1 |
+
fastai
|
| 2 |
+
gradio
|