research14 commited on
Commit
1b215c9
·
1 Parent(s): 6d53495
Files changed (1) hide show
  1. app.py +14 -32
app.py CHANGED
@@ -1,41 +1,23 @@
1
  import gradio as gr
2
 
3
- # Function to display search results
4
- def search(query, strategy):
5
  # Add your search logic here
6
  results = ["Result 1", "Result 2", "Result 3"]
7
  return "\n".join(results)
8
 
9
- # Create a Gradio interface
10
- def create_gradio_interface():
11
- # Top section with input text box and buttons
12
- input_box = gr.inputs.Textbox(label="Enter your search query:")
13
- default_options = gr.inputs.Radio(label="Default Options", choices=["Option 1", "Option 2", "Option 3"])
14
 
15
- # Section 1: Strategy 1
16
- strategy_1 = gr.inputs.CheckboxGroup(label="Strategy 1", choices=["ChatGPT", "LLaMA", "Vicuna", "Alpaca", "Flan-T"])
 
 
17
 
18
- # Section 2: Strategy 2
19
- strategy_2 = gr.inputs.CheckboxGroup(label="Strategy 2", choices=["ChatGPT", "LLaMA", "Vicuna", "Alpaca", "Flan-T5"])
 
 
 
 
 
20
 
21
- # Section 3: Strategy 3
22
- strategy_3 = gr.inputs.CheckboxGroup(label="Strategy 3", choices=["ChatGPT", "LLaMA", "Vicuna", "Alpaca", "Flan-T5"])
23
-
24
- # Search results section
25
- search_results = gr.outputs.Textbox(label="Search Results")
26
-
27
- # Define the interface layout
28
- interface = gr.Interface(
29
- fn=search,
30
- inputs=[input_box, default_options, strategy_1, strategy_2, strategy_3],
31
- outputs=search_results,
32
- layout="vertical",
33
- live=True,
34
- live_output=True
35
- )
36
-
37
- return interface
38
-
39
- if __name__ == "__main__":
40
- gr_interface = create_gradio_interface()
41
- gr_interface.launch()
 
1
  import gradio as gr
2
 
3
+ def search(query, selected_strategies):
 
4
  # Add your search logic here
5
  results = ["Result 1", "Result 2", "Result 3"]
6
  return "\n".join(results)
7
 
8
+ demo = gr.Interface(fn=search, inputs=["text", "checkbox"], outputs="text")
 
 
 
 
9
 
10
+ with gr.Blocks() as demo:
11
+ with gr.Row():
12
+ input_text = gr.Textbox("text", label="Enter your search query:")
13
+ default_options = gr.Radio("text", label="Default Options", choices=["Option 1", "Option 2", "Option 3"])
14
 
15
+ with gr.Row():
16
+ with gr.Column():
17
+ strategy_1 = gr.Checkbox("text", label="Strategy 1", choices=["ChatGPT", "LLaMA", "Vicuna", "Alpaca", "Flan-T"])
18
+ with gr.Column():
19
+ strategy_2 = gr.Checkbox("text", label="Strategy 2", choices=["ChatGPT", "LLaMA", "Vicuna", "Alpaca", "Flan-T5"])
20
+ with gr.Column():
21
+ strategy_3 = gr.Checkbox("text", label="Strategy 3", choices=["ChatGPT", "LLaMA", "Vicuna", "Alpaca", "Flan-T5"])
22
 
23
+ demo.launch()