Spaces:
Sleeping
Sleeping
Ganesh Chintalapati
commited on
Commit
·
2b14256
1
Parent(s):
2709e97
final version v2
Browse files
app.py
CHANGED
@@ -10,7 +10,12 @@ with gr.Blocks(theme=gr.themes.Soft(), css=".full-height { height: 100%; display
|
|
10 |
providers = gr.CheckboxGroup(choices=["OpenAI", "Anthropic", "Gemini"], label="Select Providers", value=["OpenAI"], elem_classes="checkbox-group")
|
11 |
|
12 |
with gr.Row(elem_classes="full-height"):
|
13 |
-
query = gr.Textbox(
|
|
|
|
|
|
|
|
|
|
|
14 |
submit_button = gr.Button("Submit", scale=1)
|
15 |
|
16 |
with gr.Row():
|
@@ -23,11 +28,19 @@ with gr.Blocks(theme=gr.themes.Soft(), css=".full-height { height: 100%; display
|
|
23 |
|
24 |
chat_history = gr.State([])
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
submit_button.click(
|
27 |
fn=submit_query,
|
28 |
inputs=[query, providers, chat_history],
|
29 |
outputs=[query, openai_chatbot, anthropic_chatbot, gemini_chatbot, chat_history]
|
30 |
)
|
|
|
31 |
clear_button.click(
|
32 |
fn=clear_history,
|
33 |
inputs=[],
|
|
|
10 |
providers = gr.CheckboxGroup(choices=["OpenAI", "Anthropic", "Gemini"], label="Select Providers", value=["OpenAI"], elem_classes="checkbox-group")
|
11 |
|
12 |
with gr.Row(elem_classes="full-height"):
|
13 |
+
query = gr.Textbox(
|
14 |
+
label="Enter your query",
|
15 |
+
placeholder="e.g., What is the capital of the United States?",
|
16 |
+
scale=4,
|
17 |
+
autofocus=True # This will focus the textbox on load
|
18 |
+
)
|
19 |
submit_button = gr.Button("Submit", scale=1)
|
20 |
|
21 |
with gr.Row():
|
|
|
28 |
|
29 |
chat_history = gr.State([])
|
30 |
|
31 |
+
# Handle both button click and Enter key
|
32 |
+
query.submit(
|
33 |
+
fn=submit_query,
|
34 |
+
inputs=[query, providers, chat_history],
|
35 |
+
outputs=[query, openai_chatbot, anthropic_chatbot, gemini_chatbot, chat_history]
|
36 |
+
)
|
37 |
+
|
38 |
submit_button.click(
|
39 |
fn=submit_query,
|
40 |
inputs=[query, providers, chat_history],
|
41 |
outputs=[query, openai_chatbot, anthropic_chatbot, gemini_chatbot, chat_history]
|
42 |
)
|
43 |
+
|
44 |
clear_button.click(
|
45 |
fn=clear_history,
|
46 |
inputs=[],
|