Spaces:
Sleeping
Sleeping
Ganesh Chintalapati
commited on
Commit
·
e86c932
1
Parent(s):
a44283e
modular code apsssjjjadfdrfe
Browse files
app.py
CHANGED
|
@@ -1,41 +1,34 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from core import submit_query
|
| 3 |
-
|
| 4 |
-
with gr.Blocks(theme=gr.themes.Soft(), css=\"\"\"
|
| 5 |
-
.full-height { height: 100%; display: flex; align-items: stretch; min-height: 40px; }
|
| 6 |
-
.full-height button { height: 100%; padding: 8px 16px; }
|
| 7 |
-
.providers-row { height: 100%; display: flex; align-items: stretch; min-height: 40px; }
|
| 8 |
-
.providers-row .checkbox-group { height: 100%; display: flex; flex-direction: row; align-items: center; gap: 10px; }
|
| 9 |
-
\"\"\") as demo:
|
| 10 |
-
gr.Markdown("# Multi-Model Chat")
|
| 11 |
-
gr.Markdown("Chat with OpenAI, Anthropic, or Gemini. Select providers and compare responses side by side!")
|
| 12 |
-
|
| 13 |
-
with gr.Row(elem_classes="providers-row"):
|
| 14 |
-
providers = gr.CheckboxGroup(choices=["OpenAI", "Anthropic", "Gemini"], label="Select Providers", value=["OpenAI"], elem_classes="checkbox-group")
|
| 15 |
-
|
| 16 |
-
with gr.Row(elem_classes="full-height"):
|
| 17 |
-
query = gr.Textbox(label="Enter your query", placeholder="e.g., What is the capital of the United States?", scale=4)
|
| 18 |
-
submit_button = gr.Button("Submit", scale=1)
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
with gr.Row():
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
| 31 |
fn=submit_query,
|
| 32 |
-
inputs=[
|
| 33 |
-
outputs=
|
| 34 |
)
|
| 35 |
-
|
| 36 |
-
fn=
|
| 37 |
-
inputs=
|
| 38 |
-
outputs=[
|
|
|
|
| 39 |
)
|
| 40 |
|
| 41 |
-
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from core import submit_query
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
+
with gr.Blocks(theme=gr.themes.Soft(), css="""
|
| 5 |
+
.gradio-container {background-color: #f0f4f8;}
|
| 6 |
+
.chatbot {border-radius: 10px;}
|
| 7 |
+
""") as demo:
|
| 8 |
+
gr.Markdown("# Multi-Provider AI Chatbot")
|
| 9 |
with gr.Row():
|
| 10 |
+
with gr.Column(scale=1):
|
| 11 |
+
provider_select = gr.CheckboxGroup(
|
| 12 |
+
choices=["OpenAI", "Anthropic", "Gemini"],
|
| 13 |
+
value=["OpenAI", "Anthropic", "Gemini"],
|
| 14 |
+
label="Select Providers"
|
| 15 |
+
)
|
| 16 |
+
with gr.Column(scale=3):
|
| 17 |
+
chatbot = gr.Chatbot(label="Chatbot Responses")
|
| 18 |
+
query_input = gr.Textbox(label="Enter your query", placeholder="Type your question here...")
|
| 19 |
+
submit_btn = gr.Button("Submit")
|
| 20 |
+
clear_btn = gr.Button("Clear")
|
| 21 |
+
|
| 22 |
+
submit_btn.click(
|
| 23 |
fn=submit_query,
|
| 24 |
+
inputs=[query_input, provider_select],
|
| 25 |
+
outputs=chatbot
|
| 26 |
)
|
| 27 |
+
clear_btn.click(
|
| 28 |
+
fn=lambda: None,
|
| 29 |
+
inputs=None,
|
| 30 |
+
outputs=[chatbot, query_input],
|
| 31 |
+
_js="() => ['', '']"
|
| 32 |
)
|
| 33 |
|
| 34 |
+
demo.launch()
|