Spaces:
Running
Running
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -93,14 +93,13 @@ def chat(message, model_name, chat_history):
|
|
| 93 |
|
| 94 |
# Add model-specific flair
|
| 95 |
if "Creative" in model_name:
|
| 96 |
-
response = response + "\n\n🌟
|
| 97 |
elif "Powerful" in model_name:
|
| 98 |
-
response = response + "\n\n🔬
|
| 99 |
else:
|
| 100 |
-
response = response + "\n\n⚡
|
| 101 |
|
| 102 |
-
chat_history.append(
|
| 103 |
-
chat_history.append({"role": "assistant", "content": prefix + response})
|
| 104 |
|
| 105 |
return chat_history, ""
|
| 106 |
|
|
@@ -116,7 +115,7 @@ css = """
|
|
| 116 |
.assistant-message {background: #1f2c34 !important; color: #e9edef !important; padding: 10px 15px !important; border-radius: 15px 15px 15px 0 !important; margin: 5px auto 5px 0 !important; max-width: 70% !important;}
|
| 117 |
"""
|
| 118 |
|
| 119 |
-
with gr.Blocks(title="Devrayog AI"
|
| 120 |
|
| 121 |
# Header
|
| 122 |
gr.HTML("""
|
|
@@ -141,8 +140,7 @@ with gr.Blocks(title="Devrayog AI", css=css) as demo:
|
|
| 141 |
label="Chat with Devrayog AI",
|
| 142 |
height=400,
|
| 143 |
show_label=False,
|
| 144 |
-
elem_classes=["chat-container"]
|
| 145 |
-
type="messages"
|
| 146 |
)
|
| 147 |
|
| 148 |
# Input row
|
|
@@ -200,7 +198,7 @@ Best for: Complex reasoning
|
|
| 200 |
send_btn.click(fn=chat, inputs=[msg_input, model_select, chatbot], outputs=[chatbot, msg_input])
|
| 201 |
msg_input.submit(fn=chat, inputs=[msg_input, model_select, chatbot], outputs=[chatbot, msg_input])
|
| 202 |
|
| 203 |
-
# Quick buttons
|
| 204 |
btn_ssb.click(fn=lambda h: chat("What is the SSB interview process?", "Devrayog Agni (Fast)", h), inputs=[chatbot], outputs=[chatbot, msg_input])
|
| 205 |
btn_tat.click(fn=lambda h: chat("How to prepare for TAT?", "Devrayog Vayu (Creative)", h), inputs=[chatbot], outputs=[chatbot, msg_input])
|
| 206 |
btn_nda.click(fn=lambda h: chat("What is NDA exam?", "Devrayog Akash (Powerful)", h), inputs=[chatbot], outputs=[chatbot, msg_input])
|
|
|
|
| 93 |
|
| 94 |
# Add model-specific flair
|
| 95 |
if "Creative" in model_name:
|
| 96 |
+
response = response + "\n\n🌟 Crafted with creativity by Devrayog Vayu"
|
| 97 |
elif "Powerful" in model_name:
|
| 98 |
+
response = response + "\n\n🔬 Deep analysis by Devrayog Akash"
|
| 99 |
else:
|
| 100 |
+
response = response + "\n\n⚡ Quick response by Devrayog Agni"
|
| 101 |
|
| 102 |
+
chat_history.append((message, prefix + response))
|
|
|
|
| 103 |
|
| 104 |
return chat_history, ""
|
| 105 |
|
|
|
|
| 115 |
.assistant-message {background: #1f2c34 !important; color: #e9edef !important; padding: 10px 15px !important; border-radius: 15px 15px 15px 0 !important; margin: 5px auto 5px 0 !important; max-width: 70% !important;}
|
| 116 |
"""
|
| 117 |
|
| 118 |
+
with gr.Blocks(title="Devrayog AI") as demo:
|
| 119 |
|
| 120 |
# Header
|
| 121 |
gr.HTML("""
|
|
|
|
| 140 |
label="Chat with Devrayog AI",
|
| 141 |
height=400,
|
| 142 |
show_label=False,
|
| 143 |
+
elem_classes=["chat-container"]
|
|
|
|
| 144 |
)
|
| 145 |
|
| 146 |
# Input row
|
|
|
|
| 198 |
send_btn.click(fn=chat, inputs=[msg_input, model_select, chatbot], outputs=[chatbot, msg_input])
|
| 199 |
msg_input.submit(fn=chat, inputs=[msg_input, model_select, chatbot], outputs=[chatbot, msg_input])
|
| 200 |
|
| 201 |
+
# Quick buttons
|
| 202 |
btn_ssb.click(fn=lambda h: chat("What is the SSB interview process?", "Devrayog Agni (Fast)", h), inputs=[chatbot], outputs=[chatbot, msg_input])
|
| 203 |
btn_tat.click(fn=lambda h: chat("How to prepare for TAT?", "Devrayog Vayu (Creative)", h), inputs=[chatbot], outputs=[chatbot, msg_input])
|
| 204 |
btn_nda.click(fn=lambda h: chat("What is NDA exam?", "Devrayog Akash (Powerful)", h), inputs=[chatbot], outputs=[chatbot, msg_input])
|