Spaces:
Running
Running
Upload app.py with huggingface_hub
Browse files56 unmodified lines5758596060616263643 unmodified lines68697070717273747575767778767778798080818283848586878889909156 unmodified lines history = history or []
prefix = {"Agni": "π₯ ", "Vayu": "π ", "Akash": "π "}.get(model, "π₯ ")
response = get_response(message)
history.append((message, prefix + response))
history.append({"role": "user", "content": message})
history.append({"role": "assistant", "content": prefix + response})
return history, ""
with gr.Blocks(title="Devrayog AI") as demo:3 unmodified lines with gr.Row():
with gr.Column(scale=3):
model = gr.Radio(["Agni", "Vayu", "Akash"], value="Agni", label="Model")
chatbot = gr.Chatbot(height=350, show_label=False)
chatbot = gr.Chatbot(height=350, show_label=False, type="messages")
with gr.Row():
msg = gr.Textbox(placeholder="Ask about SSB, NDA, TAT...", scale=4, container=False, autofocus=True)
send = gr.Button("Send", scale=1, variant="primary")
with gr.Row():
gr.Button("π― SSB", size="sm").click(lambda h: chat("What is SSB process?", h, "Agni"), inputs=[chatbot], outputs=[chatbot, msg])
gr.Button("π NDA", size="sm").click(lambda h: chat("What is NDA?", h, "Agni"), inputs=[chatbot], outputs=[chatbot, msg])
gr.Button("π‘ Tips", size="sm").click(lambda h: chat("SSB tips", h, "Agni"), inputs=[chatbot], outputs=[chatbot, msg])
gr.Button("β OLQs", size="sm").click(lambda h: chat("15 OLQs", h, "Agni"), inputs=[chatbot], outputs=[chatbot, msg])
b1 = gr.Button("π― SSB", size="sm")
b2 = gr.Button("π NDA", size="sm")
b3 = gr.Button("π‘ Tips", size="sm")
b4 = gr.Button("β OLQs", size="sm")
with gr.Column(scale=1):
gr.Markdown("### Models\nπ₯ **Agni** - Fast\nπ **Vayu** - Creative\nπ **Agni** - Powerful\n\n### Topics\nβ’ SSB Process\nβ’ TAT/WAT/SRT\nβ’ NDA Exam\nβ’ 15 OLQs\nβ’ GTO Tasks")
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")
send.click(fn=chat, inputs=[msg, chatbot, model], outputs=[chatbot, msg])
msg.submit(fn=chat, inputs=[msg, chatbot, model], outputs=[chatbot, msg])
b1.click(fn=lambda h, m: chat("What is SSB process?", h, m), inputs=[chatbot, model], outputs=[chatbot, msg])
b2.click(fn=lambda h, m: chat("What is NDA?", h, m), inputs=[chatbot, model], outputs=[chatbot, msg])
b3.click(fn=lambda h, m: chat("SSB tips", h, m), inputs=[chatbot, model], outputs=[chatbot, msg])
b4.click(fn=lambda h, m: chat("15 OLQs", h, m), inputs=[chatbot, model], outputs=[chatbot, msg])
demo.launch(server_name="0.0.0.0", server_port=7860)app.py+13-7