Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from PIL import Image
|
| 3 |
|
|
|
|
| 4 |
animal_images = {
|
| 5 |
"cat": "cat.jpg",
|
| 6 |
"dog": "dog.jpg",
|
|
@@ -21,8 +22,8 @@ def fetch_animal_image(animal):
|
|
| 21 |
# Define the Gradio Interface
|
| 22 |
demo = gr.Interface(
|
| 23 |
fn=fetch_animal_image,
|
| 24 |
-
inputs=gr.
|
| 25 |
-
outputs=gr.
|
| 26 |
title="Favorite Animal Image",
|
| 27 |
description="Enter the name of your favorite animal and see an image of it."
|
| 28 |
)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from PIL import Image
|
| 3 |
|
| 4 |
+
# Dictionary mapping animals to image file names in the root directory
|
| 5 |
animal_images = {
|
| 6 |
"cat": "cat.jpg",
|
| 7 |
"dog": "dog.jpg",
|
|
|
|
| 22 |
# Define the Gradio Interface
|
| 23 |
demo = gr.Interface(
|
| 24 |
fn=fetch_animal_image,
|
| 25 |
+
inputs=gr.Textbox(label="What's your favorite animal?"),
|
| 26 |
+
outputs=gr.Image(type="pil"),
|
| 27 |
title="Favorite Animal Image",
|
| 28 |
description="Enter the name of your favorite animal and see an image of it."
|
| 29 |
)
|