Spaces:
Runtime error
Runtime error
added examples
Browse files- README.md +1 -1
- app.py +11 -6
- examples/carroll.jpeg +0 -0
- examples/carroll2.jpeg +0 -0
- examples/carroll3.jpeg +0 -0
- examples/nunez1.jpeg +0 -0
- examples/nunez2.jpeg +0 -0
- examples/nunez3.jpeg +0 -0
README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
---
|
| 2 |
title: Angry Carroll
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: red
|
| 5 |
colorTo: blue
|
| 6 |
sdk: gradio
|
|
|
|
| 1 |
---
|
| 2 |
title: Angry Carroll
|
| 3 |
+
emoji: 😡
|
| 4 |
colorFrom: red
|
| 5 |
colorTo: blue
|
| 6 |
sdk: gradio
|
app.py
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from fastai.vision.all import PILImage, load_learner
|
|
|
|
| 3 |
|
| 4 |
learn = load_learner("model.pkl")
|
| 5 |
labels = learn.dls.vocab
|
|
|
|
| 6 |
|
| 7 |
|
| 8 |
def predict(img):
|
|
@@ -13,12 +17,13 @@ def predict(img):
|
|
| 13 |
|
| 14 |
gradio_interface = gr.Interface(
|
| 15 |
fn=predict,
|
| 16 |
-
inputs=
|
| 17 |
-
outputs=
|
| 18 |
allow_flagging="never",
|
| 19 |
live=True,
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
|
|
|
| 23 |
)
|
| 24 |
-
gradio_interface.launch()
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
|
| 3 |
import gradio as gr
|
| 4 |
from fastai.vision.all import PILImage, load_learner
|
| 5 |
+
from gradio.components import Image, Label
|
| 6 |
|
| 7 |
learn = load_learner("model.pkl")
|
| 8 |
labels = learn.dls.vocab
|
| 9 |
+
examples = ["examples/" + file for file in os.listdir("examples")]
|
| 10 |
|
| 11 |
|
| 12 |
def predict(img):
|
|
|
|
| 17 |
|
| 18 |
gradio_interface = gr.Interface(
|
| 19 |
fn=predict,
|
| 20 |
+
inputs=Image(shape=(512, 512)),
|
| 21 |
+
outputs=Label(num_top_classes=2),
|
| 22 |
allow_flagging="never",
|
| 23 |
live=True,
|
| 24 |
+
examples=examples,
|
| 25 |
+
title="Angry Carroll",
|
| 26 |
+
description="Can AI tell the difference between Carroll and Nunez? \
|
| 27 |
+
Upload a photo or choose an example below to test it out!",
|
| 28 |
)
|
| 29 |
+
gradio_interface.launch(enable_queue=True)
|
examples/carroll.jpeg
ADDED
|
examples/carroll2.jpeg
ADDED
|
examples/carroll3.jpeg
ADDED
|
examples/nunez1.jpeg
ADDED
|
examples/nunez2.jpeg
ADDED
|
examples/nunez3.jpeg
ADDED
|