Spaces:
Sleeping
Sleeping
Create app2.py
Browse files
app2.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def greet_and_show_cat(name):
|
| 4 |
+
# Greeting message
|
| 5 |
+
greeting = f"Hello {name}!!"
|
| 6 |
+
|
| 7 |
+
# URL of a cat image
|
| 8 |
+
cat_image_url = "https://placekitten.com/400/400"
|
| 9 |
+
|
| 10 |
+
# Return both the greeting and the cat image
|
| 11 |
+
return greeting, cat_image_url
|
| 12 |
+
|
| 13 |
+
# Define the Gradio Interface
|
| 14 |
+
demo = gr.Interface(
|
| 15 |
+
fn=greet_and_show_cat, # Function that returns both greeting and cat image
|
| 16 |
+
inputs="text", # Input is a text field for the user to enter their name
|
| 17 |
+
outputs=["text", "image"] # Outputs include both text and image
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
# Launch the interface
|
| 21 |
+
demo.launch()
|