ismailmo1 commited on
Commit
e28465a
·
1 Parent(s): ceea3a5

added examples

Browse files
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=gr.inputs.Image(shape=(512, 512)),
17
- outputs=gr.outputs.Label(num_top_classes=2),
18
  allow_flagging="never",
19
  live=True,
20
- title="Angry Carroll Detector",
21
- description="Is it Nunez or Carroll? Upload a picture of either and we'll \
22
- help you figure out which one it is!",
 
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