Spaces:
Running
Running
import gradio as gr | |
# Define the sidebar items | |
sidebar_items = [ | |
{"prompt": "Hello world!", "description": "A simple greeting."}, | |
{"prompt": "What is your name?", "description": "Ask a user for their name."}, | |
# Add more prompt examples and descriptions here... | |
] | |
def greet(name): | |
return f"Hello {name}!" | |
# Create the interface with left sidebar | |
iface = gr.Interface( | |
fn=greet, | |
inputs="text", | |
outputs="text", | |
title="Greeting App", | |
description="Ask a user for their name and greet them." | |
) | |
# Add the left sidebar with prompt examples | |
iface.sidebar(sidebar_items) | |
# Launch the Gradio app | |
iface.launch() |