Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastai.vision.all import *
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
learner_madness = load_learner('madness.pkl')
|
| 5 |
+
categories = ['Hank', 'Tricky', 'Deimos', "Jeb", 'Sanford', 'The Auditor']
|
| 6 |
+
|
| 7 |
+
def classify_madness(img):
|
| 8 |
+
prediction, index, probability = learner_madness.predict(img)
|
| 9 |
+
return dict(zip(categories, map(float, probability)))
|
| 10 |
+
|
| 11 |
+
intf = gr.Interface(fn=classify_madness,
|
| 12 |
+
inputs=gr.Image(shape=(192, 192)),
|
| 13 |
+
outputs=gr.Label(),
|
| 14 |
+
examples=[])
|
| 15 |
+
intf.launch(inline=False)
|
| 16 |
+
|
| 17 |
+
|