Spaces:
Sleeping
Sleeping
Commit
·
d975bf6
1
Parent(s):
1eafe63
Autogenerate Gradio interface for Toad Frog model prediction
Browse files- app.py +5 -3
- testing/sample_frog.jpg +0 -0
- testing/sample_toad.jpg +0 -0
app.py
CHANGED
|
@@ -3,8 +3,9 @@
|
|
| 3 |
# %% auto 0
|
| 4 |
__all__ = ['toad_frog_model', 'categories', 'image', 'label', 'examples', 'gradio_interface', 'classify_image']
|
| 5 |
|
| 6 |
-
# %% ../toad_frog_testing.ipynb
|
| 7 |
-
|
|
|
|
| 8 |
|
| 9 |
# %% ../toad_frog_testing.ipynb 7
|
| 10 |
toad_frog_model = load_learner("toadfrog.pkl")
|
|
@@ -19,7 +20,8 @@ def classify_image(img_path: str):
|
|
| 19 |
# %% ../toad_frog_testing.ipynb 14
|
| 20 |
image = gr.inputs.Image(shape=(192,192))
|
| 21 |
label = gr.outputs.Label()
|
| 22 |
-
examples = ["sample_toad.jpg", "sample_frog.jpg"]
|
|
|
|
| 23 |
|
| 24 |
gradio_interface = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 25 |
gradio_interface.launch(inline=False)
|
|
|
|
| 3 |
# %% auto 0
|
| 4 |
__all__ = ['toad_frog_model', 'categories', 'image', 'label', 'examples', 'gradio_interface', 'classify_image']
|
| 5 |
|
| 6 |
+
# %% ../toad_frog_testing.ipynb 3
|
| 7 |
+
from fastai.vision.all import *
|
| 8 |
+
import gradio as gr
|
| 9 |
|
| 10 |
# %% ../toad_frog_testing.ipynb 7
|
| 11 |
toad_frog_model = load_learner("toadfrog.pkl")
|
|
|
|
| 20 |
# %% ../toad_frog_testing.ipynb 14
|
| 21 |
image = gr.inputs.Image(shape=(192,192))
|
| 22 |
label = gr.outputs.Label()
|
| 23 |
+
examples = ["testing/sample_toad.jpg", "testing/sample_frog.jpg"]
|
| 24 |
+
|
| 25 |
|
| 26 |
gradio_interface = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 27 |
gradio_interface.launch(inline=False)
|
testing/sample_frog.jpg
ADDED
|
testing/sample_toad.jpg
ADDED
|