Spaces:
Runtime error
Runtime error
import gradio as gr | |
# Assuming you have a dictionary of pet names and their image URLs or file paths | |
pet_images = { | |
"David": "./david.jpg", | |
"Kikou": "./kikou.jpg", | |
# Add as many pets as you have | |
} | |
# Define your Gradio interface here | |
def your_function(pet_name): | |
# Handle the input and produce the image path or URL | |
image_path = pet_images.get(pet_name, "./download.jpeg") # Use a valid default image path | |
return image_path | |
# Make sure to create a 'default_pet.jpg' file or provide a valid URL for this default image | |
# Create the interface | |
iface = gr.Interface(fn=your_function, inputs="text", outputs="image") | |
# Launch the interface | |
iface.launch() |