EmilyWitko HF staff commited on
Commit
aa07dbb
1 Parent(s): 7cf09d9

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ # Assuming you have a dictionary of pet names and their image URLs or file paths
4
+ pets = {
5
+ "David": "Users/EmilyWitko/desktop/David AI/david.jpg",
6
+ "Kikou": "Users/EmilyWitko/desktop/David AI/kikou.jpg",
7
+ # Add as many pets as you have
8
+ }
9
+
10
+ def show_pet_image(pet_name):
11
+ # If the pet name is in the dictionary, return the image
12
+ if pet_name in pets:
13
+ return pets[pet_name]
14
+ else:
15
+ return "Pet not found, please try another name."
16
+
17
+ iface = gr.Interface(
18
+ fn=show_pet_image,
19
+ inputs=gr.inputs.Textbox(label="Enter Pet Name"),
20
+ outputs=gr.outputs.Image(label="Pet Image"),
21
+ examples=list(pets.keys()) # Optional: to provide example pet names in the interface
22
+ )
23
+
24
+ iface.launch()