Spaces:
Runtime error
Runtime error
Commit
•
807dd72
1
Parent(s):
8d738a8
Update app.py
Browse files
app.py
CHANGED
@@ -10,12 +10,16 @@ pet_images = {
|
|
10 |
# Define your Gradio interface here
|
11 |
def your_function(pet_name):
|
12 |
# Handle the input and produce the image path or URL
|
13 |
-
image_path = pet_images.get(pet_name, "./
|
14 |
return image_path
|
15 |
|
16 |
-
# Make sure to create a 'default_pet.jpg' file or provide a valid URL for this default image
|
17 |
# Create the interface
|
18 |
iface = gr.Interface(fn=your_function, inputs="text", outputs="image")
|
19 |
|
20 |
# Launch the interface
|
21 |
-
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
10 |
# Define your Gradio interface here
|
11 |
def your_function(pet_name):
|
12 |
# Handle the input and produce the image path or URL
|
13 |
+
image_path = pet_images.get(pet_name, "./default_pet.jpg") # Use a valid default image path
|
14 |
return image_path
|
15 |
|
|
|
16 |
# Create the interface
|
17 |
iface = gr.Interface(fn=your_function, inputs="text", outputs="image")
|
18 |
|
19 |
# Launch the interface
|
20 |
+
iface.launch()
|
21 |
+
|
22 |
+
if __name__ == "__main__":
|
23 |
+
iface.input("Pet Name").send_value("Kikou") # Set the initial value for the input field
|
24 |
+
output = iface.run().result()
|
25 |
+
print(f"Image for Kikou: {output}")
|