Spaces:
Runtime error
Runtime error
Canstralian
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,17 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
#
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
9 |
|
10 |
-
|
11 |
-
return f"Hello {name}!"
|
12 |
-
|
13 |
-
# Create the interface with left sidebar
|
14 |
iface = gr.Interface(
|
15 |
fn=greet,
|
16 |
inputs="text",
|
@@ -19,8 +20,8 @@ iface = gr.Interface(
|
|
19 |
description="Ask a user for their name and greet them."
|
20 |
)
|
21 |
|
22 |
-
# Add the left sidebar
|
23 |
-
iface.sidebar
|
24 |
|
25 |
# Launch the Gradio app
|
26 |
-
iface.launch()
|
|
|
1 |
+
from gradio import components as gc
|
2 |
import gradio as gr
|
3 |
|
4 |
+
# Create a sidebar component
|
5 |
+
sidebar = gc.SideBar()
|
6 |
+
for item in sidebar_items:
|
7 |
+
prompt_button = gc.Button(text=item["prompt"])
|
8 |
+
description = item["description"]
|
9 |
+
# Add additional styling or functionality if needed
|
10 |
+
|
11 |
+
# Append the button and description to the sidebar component
|
12 |
+
sidebar.append(prompt_button, description)
|
13 |
|
14 |
+
# Create the interface without a sidebar (since we've added it separately)
|
|
|
|
|
|
|
15 |
iface = gr.Interface(
|
16 |
fn=greet,
|
17 |
inputs="text",
|
|
|
20 |
description="Ask a user for their name and greet them."
|
21 |
)
|
22 |
|
23 |
+
# Add the left sidebar to the interface
|
24 |
+
iface.add_component(sidebar, side="left")
|
25 |
|
26 |
# Launch the Gradio app
|
27 |
+
iface.launch()
|