Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -113,8 +113,24 @@ def clear_memory():
|
|
| 113 |
os.remove(MEMORY_FILE)
|
| 114 |
return [], "π§Ή Chat memory cleared! Start fresh."
|
| 115 |
|
| 116 |
-
#
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
gr.Markdown("# π **EduAI β Your Smart Study Companion**", elem_classes="header-title")
|
| 119 |
|
| 120 |
with gr.Row():
|
|
@@ -163,7 +179,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="violet")) as iface:
|
|
| 163 |
label="EduAI Chat",
|
| 164 |
height=500,
|
| 165 |
render_markdown=True,
|
| 166 |
-
|
| 167 |
latex_delimiters=[{"left": "$$", "right": "$$", "display": True}, {"left": "\\[", "right": "\\]", "display": True}]
|
| 168 |
)
|
| 169 |
|
|
@@ -179,19 +195,4 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="violet")) as iface:
|
|
| 179 |
send.click(chat_with_model, inputs=[msg, chatbot, context_display, file_input], outputs=[chatbot, chatbot])
|
| 180 |
clear_btn.click(clear_memory, outputs=[chatbot, context_display])
|
| 181 |
|
| 182 |
-
|
| 183 |
-
custom_css = """
|
| 184 |
-
.header-title { font-size: 36px; text-align:center; margin-bottom:20px; }
|
| 185 |
-
.sidebar { background-color:#f5f3ff; padding:15px; border-radius:12px; box-shadow:0 2px 6px rgba(0,0,0,0.1); }
|
| 186 |
-
.menu-title { font-size:20px; font-weight:bold; margin-bottom:10px; }
|
| 187 |
-
.main-chat { padding:10px; }
|
| 188 |
-
.context-box { background-color:#ffffff; padding:10px; border-radius:10px; box-shadow:0 1px 4px rgba(0,0,0,0.1); margin-bottom:10px; }
|
| 189 |
-
.chatbox .message.user { background-color:#e0d7ff; border-radius:10px; padding:8px; margin:5px 0; }
|
| 190 |
-
.chatbox .message.bot { background-color:#ffffff; border-radius:10px; padding:8px; margin:5px 0; box-shadow:0 1px 2px rgba(0,0,0,0.05);}
|
| 191 |
-
.chat-input { border-radius:10px; padding:8px; width:100%; }
|
| 192 |
-
.btn-send { background-color:#7c3aed; color:white; border-radius:10px; padding:8px 16px; }
|
| 193 |
-
.btn-clear { background-color:#ef4444; color:white; border-radius:10px; padding:6px 12px; }
|
| 194 |
-
.file-upload { border:2px dashed #d4b5ff; border-radius:10px; padding:10px; text-align:center; }
|
| 195 |
-
.about-text { font-size:14px; color:#4b5563; }
|
| 196 |
-
"""
|
| 197 |
-
iface.launch(css=custom_css)
|
|
|
|
| 113 |
os.remove(MEMORY_FILE)
|
| 114 |
return [], "π§Ή Chat memory cleared! Start fresh."
|
| 115 |
|
| 116 |
+
# π Custom CSS for professional look
|
| 117 |
+
custom_css = """
|
| 118 |
+
.header-title { font-size: 36px; text-align:center; margin-bottom:20px; }
|
| 119 |
+
.sidebar { background-color:#f5f3ff; padding:15px; border-radius:12px; box-shadow:0 2px 6px rgba(0,0,0,0.1); }
|
| 120 |
+
.menu-title { font-size:20px; font-weight:bold; margin-bottom:10px; }
|
| 121 |
+
.main-chat { padding:10px; }
|
| 122 |
+
.context-box { background-color:#ffffff; padding:10px; border-radius:10px; box-shadow:0 1px 4px rgba(0,0,0,0.1); margin-bottom:10px; }
|
| 123 |
+
.chatbox .message.user { background-color:#e0d7ff; border-radius:10px; padding:8px; margin:5px 0; }
|
| 124 |
+
.chatbox .message.bot { background-color:#ffffff; border-radius:10px; padding:8px; margin:5px 0; box-shadow:0 1px 2px rgba(0,0,0,0.05);}
|
| 125 |
+
.chat-input { border-radius:10px; padding:8px; width:100%; }
|
| 126 |
+
.btn-send { background-color:#7c3aed; color:white; border-radius:10px; padding:8px 16px; }
|
| 127 |
+
.btn-clear { background-color:#ef4444; color:white; border-radius:10px; padding:6px 12px; }
|
| 128 |
+
.file-upload { border:2px dashed #d4b5ff; border-radius:10px; padding:10px; text-align:center; }
|
| 129 |
+
.about-text { font-size:14px; color:#4b5563; }
|
| 130 |
+
"""
|
| 131 |
+
|
| 132 |
+
# π¨ Gradio Interface with CSS included
|
| 133 |
+
with gr.Blocks(theme=gr.themes.Soft(primary_hue="violet"), css=custom_css) as iface:
|
| 134 |
gr.Markdown("# π **EduAI β Your Smart Study Companion**", elem_classes="header-title")
|
| 135 |
|
| 136 |
with gr.Row():
|
|
|
|
| 179 |
label="EduAI Chat",
|
| 180 |
height=500,
|
| 181 |
render_markdown=True,
|
| 182 |
+
type="messages", # β
Fixed deprecation warning
|
| 183 |
latex_delimiters=[{"left": "$$", "right": "$$", "display": True}, {"left": "\\[", "right": "\\]", "display": True}]
|
| 184 |
)
|
| 185 |
|
|
|
|
| 195 |
send.click(chat_with_model, inputs=[msg, chatbot, context_display, file_input], outputs=[chatbot, chatbot])
|
| 196 |
clear_btn.click(clear_memory, outputs=[chatbot, context_display])
|
| 197 |
|
| 198 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|