Spaces:
Runtime error
Runtime error
Kelly Nicholes commited on
Commit ·
add35df
1
Parent(s): 8f37a0a
Try this
Browse files- app.py +9 -6
- requirements.txt +2 -1
app.py
CHANGED
|
@@ -1,8 +1,7 @@
|
|
| 1 |
-
# Cell
|
| 2 |
-
from fastai.vision.all import *
|
| 3 |
import gradio as gr
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
# Cell
|
| 6 |
learn = load_learner('model.pkl')
|
| 7 |
|
| 8 |
labels = learn.dls.vocab
|
|
@@ -11,6 +10,10 @@ def predict(img):
|
|
| 11 |
pred,pred_idx,probs = learn.predict(img)
|
| 12 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 13 |
|
| 14 |
-
|
| 15 |
-
demo.
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from fastai.vision.all import *
|
| 3 |
+
import skimage
|
| 4 |
|
|
|
|
| 5 |
learn = load_learner('model.pkl')
|
| 6 |
|
| 7 |
labels = learn.dls.vocab
|
|
|
|
| 10 |
pred,pred_idx,probs = learn.predict(img)
|
| 11 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 12 |
|
| 13 |
+
title = "Adobe Building Classifier"
|
| 14 |
+
description = "An Adobe Building classifier trained on pictures from duckduckgo with fastai. Created as a demo for Gradio and HuggingFace Spaces."
|
| 15 |
+
examples = []
|
| 16 |
+
interpretation='default'
|
| 17 |
+
enable_queue=True
|
| 18 |
+
|
| 19 |
+
gr.Interface(fn=predict,inputs="image",outputs=gr.Label(num_top_classes=3),title=title,description=description,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch()
|
requirements.txt
CHANGED
|
@@ -1 +1,2 @@
|
|
| 1 |
-
fastai
|
|
|
|
|
|
| 1 |
+
fastai
|
| 2 |
+
scikit-image
|