Spaces:
Runtime error
Runtime error
import gradio as gr | |
# Function to display search results | |
def search(query, strategy): | |
# Add your search logic here | |
results = ["Result 1", "Result 2", "Result 3"] | |
return "\n".join(results) | |
# Create a Gradio interface | |
def create_gradio_interface(): | |
# Top section with input text box and buttons | |
input_box = gr.inputs.Textbox(label="Enter your search query:") | |
default_options = gr.inputs.Radio(label="Default Options", choices=["Option 1", "Option 2", "Option 3"]) | |
# Section 1: Strategy 1 | |
strategy_1 = gr.inputs.CheckboxGroup(label="Strategy 1", choices=["ChatGPT", "LLaMA", "Vicuna", "Alpaca", "Flan-T"]) | |
# Section 2: Strategy 2 | |
strategy_2 = gr.inputs.CheckboxGroup(label="Strategy 2", choices=["ChatGPT", "LLaMA", "Vicuna", "Alpaca", "Flan-T5"]) | |
# Section 3: Strategy 3 | |
strategy_3 = gr.inputs.CheckboxGroup(label="Strategy 3", choices=["ChatGPT", "LLaMA", "Vicuna", "Alpaca", "Flan-T5"]) | |
# Define the interface layout | |
interface = gr.Interface( | |
fn=search, | |
inputs=[input_box, default_options], | |
outputs="text", | |
layout=[ | |
[input_box, default_options], | |
["Section 1: Strategy 1", strategy_1], | |
["Section 2: Strategy 2", strategy_2], | |
["Section 3: Strategy 3", strategy_3] | |
], | |
live=True, | |
live_output=True | |
) | |
return interface | |
if __name__ == "__main__": | |
gr_interface = create_gradio_interface() | |
gr_interface.launch() | |