File size: 739 Bytes
aa07dbb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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()