Spaces:
Running
Running
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -17,7 +17,7 @@ KB = {
|
|
| 17 |
"gto": "GTO Tasks: Group Discussion, Group Planning, Progressive Group Task, Half Group Task, Command Task, Final Group Task.",
|
| 18 |
"15 olqs": "15 Officer-Like Qualities:\n1. Effective Intelligence\n2. Reasoning Ability\n3. Organizing Ability\n4. Power of Expression\n5. Social Adaptability\n6. Cooperation\n7. Sense of Responsibility\n8. Initiative\n9. Self Confidence\n10. Speed of Decision\n11. Ability to Influence\n12. Liveliness\n13. Determination\n14. Courage\n15. Stamina",
|
| 19 |
"devrayog": "Devrayog AI is India's first solo-built AI, founded by Devanshu Sharma (Hermes), 18, from Neem Ka Thana, Rajasthan. 3 models: Agni (Fast), Vayu (Creative), Akash (Powerful).",
|
| 20 |
-
"hello": "Hello! I'm Devrayog AI, India's first solo-built AI. I can help with:\n
|
| 21 |
}
|
| 22 |
|
| 23 |
def get_response(msg):
|
|
@@ -48,43 +48,47 @@ def get_response(msg):
|
|
| 48 |
if any(w in msg for w in ["devrayog","hermes","founder","about"]):
|
| 49 |
return KB["devrayog"]
|
| 50 |
if any(w in msg for w in ["help","what can","how to use"]):
|
| 51 |
-
return "I can help with:\n
|
| 52 |
-
return f"Thanks for asking about '{msg}'!
|
| 53 |
|
| 54 |
-
def
|
|
|
|
| 55 |
if not message.strip():
|
| 56 |
-
return
|
| 57 |
-
|
| 58 |
-
prefix = {"Agni": "🔥 ", "Vayu": "🌊 ", "Akash": "🌌 "}.get(model, "🔥 ")
|
| 59 |
response = get_response(message)
|
| 60 |
-
|
| 61 |
-
return history, ""
|
| 62 |
|
| 63 |
with gr.Blocks(title="Devrayog AI") as demo:
|
| 64 |
-
gr.Markdown("#
|
| 65 |
gr.Markdown("*India's First Solo-Built AI | Hermes, 18, Rajasthan*")
|
| 66 |
|
|
|
|
|
|
|
| 67 |
with gr.Row():
|
| 68 |
with gr.Column(scale=3):
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 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 |
-
b1 = gr.Button("🎯 SSB", size="sm")
|
| 76 |
-
b2 = gr.Button("📚 NDA", size="sm")
|
| 77 |
-
b3 = gr.Button("💡 Tips", size="sm")
|
| 78 |
-
b4 = gr.Button("⭐ OLQs", size="sm")
|
| 79 |
with gr.Column(scale=1):
|
| 80 |
-
gr.Markdown("###
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
-
send.click(fn=
|
| 83 |
-
msg.submit(fn=
|
| 84 |
|
| 85 |
-
b1.click(fn=lambda
|
| 86 |
-
b2.click(fn=lambda
|
| 87 |
-
b3.click(fn=lambda
|
| 88 |
-
b4.click(fn=lambda
|
|
|
|
|
|
|
| 89 |
|
| 90 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 17 |
"gto": "GTO Tasks: Group Discussion, Group Planning, Progressive Group Task, Half Group Task, Command Task, Final Group Task.",
|
| 18 |
"15 olqs": "15 Officer-Like Qualities:\n1. Effective Intelligence\n2. Reasoning Ability\n3. Organizing Ability\n4. Power of Expression\n5. Social Adaptability\n6. Cooperation\n7. Sense of Responsibility\n8. Initiative\n9. Self Confidence\n10. Speed of Decision\n11. Ability to Influence\n12. Liveliness\n13. Determination\n14. Courage\n15. Stamina",
|
| 19 |
"devrayog": "Devrayog AI is India's first solo-built AI, founded by Devanshu Sharma (Hermes), 18, from Neem Ka Thana, Rajasthan. 3 models: Agni (Fast), Vayu (Creative), Akash (Powerful).",
|
| 20 |
+
"hello": "Hello! I'm Devrayog AI, India's first solo-built AI. I can help with:\n- SSB Interview Prep\n- NDA Exam Info\n- TAT/WAT/SRT/PPDT Tips\n- Current Affairs\n\nTry: 'What is SSB?', 'SSB tips', '15 OLQs', 'What is NDA?'",
|
| 21 |
}
|
| 22 |
|
| 23 |
def get_response(msg):
|
|
|
|
| 48 |
if any(w in msg for w in ["devrayog","hermes","founder","about"]):
|
| 49 |
return KB["devrayog"]
|
| 50 |
if any(w in msg for w in ["help","what can","how to use"]):
|
| 51 |
+
return "I can help with:\n- SSB Process & Tips\n- NDA Exam Info\n- TAT/WAT/SRT/PPDT\n- 15 OLQs\n- Current Affairs\n\nJust ask!"
|
| 52 |
+
return f"Thanks for asking about '{msg}'! Try: SSB, NDA, TAT, WAT, SRT, PPDT, GTO, 15 OLQs"
|
| 53 |
|
| 54 |
+
def respond(message, model):
|
| 55 |
+
"""Simple respond function - takes message and model, returns response"""
|
| 56 |
if not message.strip():
|
| 57 |
+
return ""
|
| 58 |
+
prefix = {"Agni": "[Agni] ", "Vayu": "[Vayu] ", "Akash": "[Akash] "}.get(model, "[Agni] ")
|
|
|
|
| 59 |
response = get_response(message)
|
| 60 |
+
return prefix + response
|
|
|
|
| 61 |
|
| 62 |
with gr.Blocks(title="Devrayog AI") as demo:
|
| 63 |
+
gr.Markdown("# Devrayog AI")
|
| 64 |
gr.Markdown("*India's First Solo-Built AI | Hermes, 18, Rajasthan*")
|
| 65 |
|
| 66 |
+
model = gr.Radio(["Agni", "Vayu", "Akash"], value="Agni", label="Model")
|
| 67 |
+
|
| 68 |
with gr.Row():
|
| 69 |
with gr.Column(scale=3):
|
| 70 |
+
msg = gr.Textbox(placeholder="Ask about SSB, NDA, TAT...", container=False, autofocus=True, label="Your Question")
|
| 71 |
+
output = gr.Textbox(lines=10, label="Devrayog AI Response", interactive=False)
|
| 72 |
+
send = gr.Button("Send", variant="primary")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
with gr.Column(scale=1):
|
| 74 |
+
gr.Markdown("### Quick Topics")
|
| 75 |
+
b1 = gr.Button("SSB Process")
|
| 76 |
+
b2 = gr.Button("NDA Info")
|
| 77 |
+
b3 = gr.Button("SSB Tips")
|
| 78 |
+
b4 = gr.Button("15 OLQs")
|
| 79 |
+
b5 = gr.Button("TAT Tips")
|
| 80 |
+
b6 = gr.Button("WAT Tips")
|
| 81 |
+
|
| 82 |
+
gr.Markdown("### Models: Agni (Fast) | Vayu (Creative) | Akash (Powerful)")
|
| 83 |
|
| 84 |
+
send.click(fn=respond, inputs=[msg, model], outputs=[output])
|
| 85 |
+
msg.submit(fn=respond, inputs=[msg, model], outputs=[output])
|
| 86 |
|
| 87 |
+
b1.click(fn=lambda m: respond("What is SSB process?", m), inputs=[model], outputs=[output])
|
| 88 |
+
b2.click(fn=lambda m: respond("What is NDA?", m), inputs=[model], outputs=[output])
|
| 89 |
+
b3.click(fn=lambda m: respond("SSB tips", m), inputs=[model], outputs=[output])
|
| 90 |
+
b4.click(fn=lambda m: respond("15 OLQs", m), inputs=[model], outputs=[output])
|
| 91 |
+
b5.click(fn=lambda m: respond("TAT tips", m), inputs=[model], outputs=[output])
|
| 92 |
+
b6.click(fn=lambda m: respond("WAT tips", m), inputs=[model], outputs=[output])
|
| 93 |
|
| 94 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|