PetsatHF / app.py
EmilyWitko's picture
EmilyWitko HF staff
Create app.py
aa07dbb verified
import gradio as gr
# Assuming you have a dictionary of pet names and their image URLs or file paths
pets = {
"David": "Users/EmilyWitko/desktop/David AI/david.jpg",
"Kikou": "Users/EmilyWitko/desktop/David AI/kikou.jpg",
# Add as many pets as you have
}
def show_pet_image(pet_name):
# If the pet name is in the dictionary, return the image
if pet_name in pets:
return pets[pet_name]
else:
return "Pet not found, please try another name."
iface = gr.Interface(
fn=show_pet_image,
inputs=gr.inputs.Textbox(label="Enter Pet Name"),
outputs=gr.outputs.Image(label="Pet Image"),
examples=list(pets.keys()) # Optional: to provide example pet names in the interface
)
iface.launch()