research14 commited on
Commit
182a838
·
1 Parent(s): 6f1af31

Test program for interface

Browse files
Files changed (1) hide show
  1. app.py +38 -11
app.py CHANGED
@@ -1,16 +1,43 @@
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!"
 
 
 
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
7
 
8
- with gr.Blocks() as demo:
9
- with gr.Row():
10
- btn0 = gr.Button("ChatGPT", scale=1)
11
- btn1 = gr.Button("LLaMA", scale=1)
12
- btn2 = gr.Button("Vicuna", scale=1)
13
- btn3 = gr.Button("Alpaca", scale=1)
14
- btn4 = gr.Button("Flan-T5", scale=1)
15
 
16
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # Define the interface layout
25
+ interface = gr.Interface(
26
+ fn=search,
27
+ inputs=[input_box, default_options],
28
+ outputs="text",
29
+ layout=[
30
+ [input_box, default_options],
31
+ ["Section 1: Strategy 1", strategy_1],
32
+ ["Section 2: Strategy 2", strategy_2],
33
+ ["Section 3: Strategy 3", strategy_3]
34
+ ],
35
+ live=True,
36
+ live_output=True
37
+ )
38
+
39
+ return interface
40
+
41
+ if __name__ == "__main__":
42
+ gr_interface = create_gradio_interface()
43
+ gr_interface.launch()