Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -113,7 +113,7 @@ def clear_memory():
|
|
| 113 |
os.remove(MEMORY_FILE)
|
| 114 |
return [], "π§Ή Chat memory cleared! Start fresh."
|
| 115 |
|
| 116 |
-
# π Custom CSS for dark theme and professional look
|
| 117 |
custom_css = """
|
| 118 |
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;600&display=swap');
|
| 119 |
|
|
@@ -203,10 +203,15 @@ body {
|
|
| 203 |
margin: 8px 0;
|
| 204 |
box-shadow: 0 2px 6px rgba(0,0,0,0.3);
|
| 205 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
.chat-input {
|
|
|
|
| 207 |
border-radius: 10px;
|
| 208 |
padding: 12px;
|
| 209 |
-
width: 100%;
|
| 210 |
border: 1px solid #555;
|
| 211 |
background: #2a2a2a;
|
| 212 |
color: #e0e0e0;
|
|
@@ -216,6 +221,24 @@ body {
|
|
| 216 |
border-color: #4CAF50;
|
| 217 |
outline: none;
|
| 218 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
.btn-send {
|
| 220 |
background: #4CAF50;
|
| 221 |
color: #1e1e1e;
|
|
@@ -242,18 +265,6 @@ body {
|
|
| 242 |
.btn-clear:hover {
|
| 243 |
background: #d32f2f;
|
| 244 |
}
|
| 245 |
-
.file-upload {
|
| 246 |
-
border: 2px dashed #4CAF50;
|
| 247 |
-
border-radius: 10px;
|
| 248 |
-
padding: 15px;
|
| 249 |
-
text-align: center;
|
| 250 |
-
background: #2a2a2a;
|
| 251 |
-
color: #e0e0e0;
|
| 252 |
-
transition: border-color 0.3s;
|
| 253 |
-
}
|
| 254 |
-
.file-upload:hover {
|
| 255 |
-
border-color: #45a049;
|
| 256 |
-
}
|
| 257 |
.about-text {
|
| 258 |
font-size: 14px;
|
| 259 |
color: #aaa;
|
|
@@ -267,7 +278,7 @@ body {
|
|
| 267 |
}
|
| 268 |
"""
|
| 269 |
|
| 270 |
-
# π¨ Gradio Interface with dark theme and professional styling
|
| 271 |
with gr.Blocks(theme=gr.themes.Base(), css=custom_css) as iface: # Using Base theme for full custom control
|
| 272 |
gr.Markdown("# π **EduAI β Your Professional Study Companion**", elem_classes="header-title")
|
| 273 |
|
|
@@ -321,9 +332,9 @@ with gr.Blocks(theme=gr.themes.Base(), css=custom_css) as iface: # Using Base t
|
|
| 321 |
latex_delimiters=[{"left": "$$", "right": "$$", "display": True}, {"left": "\\[", "right": "\\]", "display": True}]
|
| 322 |
)
|
| 323 |
|
| 324 |
-
with gr.Row():
|
| 325 |
-
msg = gr.Textbox(label="Ask EduAI:", placeholder="Type your question here...", elem_classes="chat-input")
|
| 326 |
-
file_input = gr.File(label="
|
| 327 |
send = gr.Button("Send βοΈ", elem_classes="btn-send")
|
| 328 |
|
| 329 |
# Event Handlers
|
|
|
|
| 113 |
os.remove(MEMORY_FILE)
|
| 114 |
return [], "π§Ή Chat memory cleared! Start fresh."
|
| 115 |
|
| 116 |
+
# π Custom CSS for dark theme and professional look, with file uploader as a symbol in the text area
|
| 117 |
custom_css = """
|
| 118 |
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;600&display=swap');
|
| 119 |
|
|
|
|
| 203 |
margin: 8px 0;
|
| 204 |
box-shadow: 0 2px 6px rgba(0,0,0,0.3);
|
| 205 |
}
|
| 206 |
+
.input-row {
|
| 207 |
+
display: flex;
|
| 208 |
+
align-items: center;
|
| 209 |
+
gap: 10px;
|
| 210 |
+
}
|
| 211 |
.chat-input {
|
| 212 |
+
flex: 1;
|
| 213 |
border-radius: 10px;
|
| 214 |
padding: 12px;
|
|
|
|
| 215 |
border: 1px solid #555;
|
| 216 |
background: #2a2a2a;
|
| 217 |
color: #e0e0e0;
|
|
|
|
| 221 |
border-color: #4CAF50;
|
| 222 |
outline: none;
|
| 223 |
}
|
| 224 |
+
.file-upload {
|
| 225 |
+
width: 40px;
|
| 226 |
+
height: 40px;
|
| 227 |
+
border: 1px solid #555;
|
| 228 |
+
border-radius: 10px;
|
| 229 |
+
background: #2a2a2a;
|
| 230 |
+
color: #e0e0e0;
|
| 231 |
+
display: flex;
|
| 232 |
+
align-items: center;
|
| 233 |
+
justify-content: center;
|
| 234 |
+
cursor: pointer;
|
| 235 |
+
transition: background 0.3s;
|
| 236 |
+
font-size: 18px;
|
| 237 |
+
}
|
| 238 |
+
.file-upload:hover {
|
| 239 |
+
background: #4CAF50;
|
| 240 |
+
color: #1e1e1e;
|
| 241 |
+
}
|
| 242 |
.btn-send {
|
| 243 |
background: #4CAF50;
|
| 244 |
color: #1e1e1e;
|
|
|
|
| 265 |
.btn-clear:hover {
|
| 266 |
background: #d32f2f;
|
| 267 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 268 |
.about-text {
|
| 269 |
font-size: 14px;
|
| 270 |
color: #aaa;
|
|
|
|
| 278 |
}
|
| 279 |
"""
|
| 280 |
|
| 281 |
+
# π¨ Gradio Interface with dark theme and professional styling, file uploader as a symbol in the text area
|
| 282 |
with gr.Blocks(theme=gr.themes.Base(), css=custom_css) as iface: # Using Base theme for full custom control
|
| 283 |
gr.Markdown("# π **EduAI β Your Professional Study Companion**", elem_classes="header-title")
|
| 284 |
|
|
|
|
| 332 |
latex_delimiters=[{"left": "$$", "right": "$$", "display": True}, {"left": "\\[", "right": "\\]", "display": True}]
|
| 333 |
)
|
| 334 |
|
| 335 |
+
with gr.Row(elem_classes="input-row"):
|
| 336 |
+
msg = gr.Textbox(label="Ask EduAI:", placeholder="Type your question here...", elem_classes="chat-input", show_label=False)
|
| 337 |
+
file_input = gr.File(label="π", file_types=[".pdf", ".docx", ".png", ".jpg"], elem_classes="file-upload", show_label=False)
|
| 338 |
send = gr.Button("Send βοΈ", elem_classes="btn-send")
|
| 339 |
|
| 340 |
# Event Handlers
|