Spaces:
Sleeping
Sleeping
Markus Zhang
commited on
Commit
·
774d1ad
1
Parent(s):
0ea45f4
Fix img input bug
Browse files- app.py +2 -2
- requirements.txt +2 -1
app.py
CHANGED
@@ -6,7 +6,7 @@ learn = load_learner('export.pkl')
|
|
6 |
|
7 |
labels = learn.dls.vocab
|
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 |
|
@@ -16,4 +16,4 @@ examples = ['blackcub.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,description=description,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch()
|
|
|
6 |
|
7 |
labels = learn.dls.vocab
|
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 |
|
|
|
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,description=description,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch(share=True)
|
requirements.txt
CHANGED
@@ -1,2 +1,3 @@
|
|
1 |
fastai
|
2 |
-
scikit-image
|
|
|
|
1 |
fastai
|
2 |
+
scikit-image
|
3 |
+
gradio
|