Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,22 +1,26 @@
|
|
| 1 |
-
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
num_return_sequences=1,
|
| 18 |
-
return_dict_in_generate=True,
|
| 19 |
-
temperature=0.7
|
| 20 |
)
|
| 21 |
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
|
| 3 |
+
# Define the sidebar items
|
| 4 |
+
sidebar_items = [
|
| 5 |
+
{"prompt": "Hello world!", "description": "A simple greeting."},
|
| 6 |
+
{"prompt": "What is your name?", "description": "Ask a user for their name."},
|
| 7 |
+
# Add more prompt examples and descriptions here...
|
| 8 |
+
]
|
| 9 |
|
| 10 |
+
def greet(name):
|
| 11 |
+
return f"Hello {name}!"
|
| 12 |
|
| 13 |
+
# Create the interface with left sidebar
|
| 14 |
+
iface = gr.Interface(
|
| 15 |
+
fn=greet,
|
| 16 |
+
inputs="text",
|
| 17 |
+
outputs="text",
|
| 18 |
+
title="Greeting App",
|
| 19 |
+
description="Ask a user for their name and greet them."
|
|
|
|
|
|
|
|
|
|
| 20 |
)
|
| 21 |
|
| 22 |
+
# Add the left sidebar with prompt examples
|
| 23 |
+
iface.sidebar(sidebar_items)
|
| 24 |
+
|
| 25 |
+
# Launch the Gradio app
|
| 26 |
+
iface.launch()
|