Spaces:
Runtime error
Runtime error
Mark Henry commited on
Commit ·
c50bffa
1
Parent(s): f51ff47
update for compat with latest gradio
Browse files
app.py
CHANGED
|
@@ -7,8 +7,6 @@ import gradio as gr
|
|
| 7 |
|
| 8 |
import fastai
|
| 9 |
|
| 10 |
-
print(fastai.__version__)
|
| 11 |
-
|
| 12 |
|
| 13 |
# This method is required for unpickling
|
| 14 |
def label_for_path(path):
|
|
@@ -25,7 +23,6 @@ def label_for_path(path):
|
|
| 25 |
|
| 26 |
|
| 27 |
learn_inf = load_learner(Path() / 'gluten.pkl')
|
| 28 |
-
|
| 29 |
categories = ('glutenful', 'gluten-free')
|
| 30 |
|
| 31 |
|
|
@@ -35,8 +32,9 @@ def classify_image(img):
|
|
| 35 |
return {categories[i]: float(probs[i]) for i in range(len(categories))}
|
| 36 |
|
| 37 |
|
| 38 |
-
image = gr.
|
| 39 |
-
label = gr.
|
|
|
|
| 40 |
# examples = all files in the /examples folder
|
| 41 |
examples = [f"examples/{i}" for i in os.listdir("examples")]
|
| 42 |
|
|
|
|
| 7 |
|
| 8 |
import fastai
|
| 9 |
|
|
|
|
|
|
|
| 10 |
|
| 11 |
# This method is required for unpickling
|
| 12 |
def label_for_path(path):
|
|
|
|
| 23 |
|
| 24 |
|
| 25 |
learn_inf = load_learner(Path() / 'gluten.pkl')
|
|
|
|
| 26 |
categories = ('glutenful', 'gluten-free')
|
| 27 |
|
| 28 |
|
|
|
|
| 32 |
return {categories[i]: float(probs[i]) for i in range(len(categories))}
|
| 33 |
|
| 34 |
|
| 35 |
+
image = gr.Image()
|
| 36 |
+
label = gr.Label()
|
| 37 |
+
|
| 38 |
# examples = all files in the /examples folder
|
| 39 |
examples = [f"examples/{i}" for i in os.listdir("examples")]
|
| 40 |
|