Spaces:
Running
Running
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -57,7 +57,8 @@ def chat(message, history, model):
|
|
| 57 |
history = history or []
|
| 58 |
prefix = {"Agni": "π₯ ", "Vayu": "π ", "Akash": "π "}.get(model, "π₯ ")
|
| 59 |
response = get_response(message)
|
| 60 |
-
history.append(
|
|
|
|
| 61 |
return history, ""
|
| 62 |
|
| 63 |
with gr.Blocks(title="Devrayog AI") as demo:
|
|
@@ -67,19 +68,24 @@ with gr.Blocks(title="Devrayog AI") as demo:
|
|
| 67 |
with gr.Row():
|
| 68 |
with gr.Column(scale=3):
|
| 69 |
model = gr.Radio(["Agni", "Vayu", "Akash"], value="Agni", label="Model")
|
| 70 |
-
chatbot = gr.Chatbot(height=350, show_label=False)
|
| 71 |
with gr.Row():
|
| 72 |
msg = gr.Textbox(placeholder="Ask about SSB, NDA, TAT...", scale=4, container=False, autofocus=True)
|
| 73 |
send = gr.Button("Send", scale=1, variant="primary")
|
| 74 |
with gr.Row():
|
| 75 |
-
gr.Button("π― SSB", size="sm")
|
| 76 |
-
gr.Button("π NDA", size="sm")
|
| 77 |
-
gr.Button("π‘ Tips", size="sm")
|
| 78 |
-
gr.Button("β OLQs", size="sm")
|
| 79 |
with gr.Column(scale=1):
|
| 80 |
-
gr.Markdown("### Models\nπ₯ **Agni** - Fast\nπ **Vayu** - Creative\nπ **
|
| 81 |
|
| 82 |
send.click(fn=chat, inputs=[msg, chatbot, model], outputs=[chatbot, msg])
|
| 83 |
msg.submit(fn=chat, inputs=[msg, chatbot, model], outputs=[chatbot, msg])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 57 |
history = history or []
|
| 58 |
prefix = {"Agni": "π₯ ", "Vayu": "π ", "Akash": "π "}.get(model, "π₯ ")
|
| 59 |
response = get_response(message)
|
| 60 |
+
history.append({"role": "user", "content": message})
|
| 61 |
+
history.append({"role": "assistant", "content": prefix + response})
|
| 62 |
return history, ""
|
| 63 |
|
| 64 |
with gr.Blocks(title="Devrayog AI") as demo:
|
|
|
|
| 68 |
with gr.Row():
|
| 69 |
with gr.Column(scale=3):
|
| 70 |
model = gr.Radio(["Agni", "Vayu", "Akash"], value="Agni", label="Model")
|
| 71 |
+
chatbot = gr.Chatbot(height=350, show_label=False, type="messages")
|
| 72 |
with gr.Row():
|
| 73 |
msg = gr.Textbox(placeholder="Ask about SSB, NDA, TAT...", scale=4, container=False, autofocus=True)
|
| 74 |
send = gr.Button("Send", scale=1, variant="primary")
|
| 75 |
with gr.Row():
|
| 76 |
+
b1 = gr.Button("π― SSB", size="sm")
|
| 77 |
+
b2 = gr.Button("π NDA", size="sm")
|
| 78 |
+
b3 = gr.Button("π‘ Tips", size="sm")
|
| 79 |
+
b4 = gr.Button("β OLQs", size="sm")
|
| 80 |
with gr.Column(scale=1):
|
| 81 |
+
gr.Markdown("### Models\nπ₯ **Agni** - Fast\nπ **Vayu** - Creative\nπ **Akash** - Powerful\n\n### Topics\nβ’ SSB Process\nβ’ TAT/WAT/SRT\nβ’ NDA Exam\nβ’ 15 OLQs\nβ’ GTO Tasks")
|
| 82 |
|
| 83 |
send.click(fn=chat, inputs=[msg, chatbot, model], outputs=[chatbot, msg])
|
| 84 |
msg.submit(fn=chat, inputs=[msg, chatbot, model], outputs=[chatbot, msg])
|
| 85 |
+
|
| 86 |
+
b1.click(fn=lambda h, m: chat("What is SSB process?", h, m), inputs=[chatbot, model], outputs=[chatbot, msg])
|
| 87 |
+
b2.click(fn=lambda h, m: chat("What is NDA?", h, m), inputs=[chatbot, model], outputs=[chatbot, msg])
|
| 88 |
+
b3.click(fn=lambda h, m: chat("SSB tips", h, m), inputs=[chatbot, model], outputs=[chatbot, msg])
|
| 89 |
+
b4.click(fn=lambda h, m: chat("15 OLQs", h, m), inputs=[chatbot, model], outputs=[chatbot, msg])
|
| 90 |
|
| 91 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|