jdesiree commited on
Commit
59e0f26
·
verified ·
1 Parent(s): 15dde1d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -45
app.py CHANGED
@@ -184,7 +184,6 @@ with gr.Blocks(theme=theme, css="""
184
  min-height: 400px;
185
  max-height: calc(100vh - 200px);
186
  }
187
-
188
  .chat-bot .message-wrap .avatar-container {
189
  display: none !important;
190
  }
@@ -195,7 +194,6 @@ with gr.Blocks(theme=theme, css="""
195
  .gradio-chatbot .message.user .avatar-container {
196
  display: none !important;
197
  }
198
-
199
  .input-row {
200
  flex-shrink: 0;
201
  margin-top: 0.5rem;
@@ -207,42 +205,33 @@ with gr.Blocks(theme=theme, css="""
207
  margin-left: auto;
208
  margin-right: auto;
209
  }
210
-
211
  .custom-textbox {
212
  flex: 1;
213
  min-width: 400px;
214
  }
215
-
216
  .custom-textbox > div {
217
  width: 100% !important;
218
  }
219
-
220
- .custom-textbox input,
221
  .custom-textbox textarea {
222
- border-radius: 25px !important;
223
- border: 2px solid #64748b !important;
224
  padding: 15px 20px !important;
225
  font-size: 16px !important;
226
  background: white !important;
227
  outline: none !important;
228
  box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
229
  transition: all 0.3s ease !important;
230
- min-height: 50px !important;
231
- height: 50px !important;
232
  width: 100% !important;
233
- resize: none !important;
234
  }
235
-
236
- .custom-textbox input:focus,
237
  .custom-textbox textarea:focus {
238
  border-color: #475569 !important;
239
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.1) !important;
240
  }
241
-
242
  .custom-textbox label {
243
  display: none !important;
244
  }
245
-
246
  .send-button {
247
  border-radius: 50% !important;
248
  width: 50px !important;
@@ -252,7 +241,6 @@ with gr.Blocks(theme=theme, css="""
252
  justify-content: center !important;
253
  flex-shrink: 0 !important;
254
  }
255
-
256
  @media (max-width: 768px) {
257
  .main-container {
258
  padding: 0.5rem;
@@ -273,34 +261,23 @@ with gr.Blocks(theme=theme, css="""
273
  .custom-textbox {
274
  min-width: 250px;
275
  }
276
- .custom-textbox textarea {
277
- border-radius: 12px !important;
278
- border: 1pt solid #64748b !important; /* 1pt slate border */
279
- padding: 15px 20px !important;
280
- font-size: 16px !important;
281
- background: white !important;
282
- outline: none !important;
283
- box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
284
- transition: all 0.3s ease !important;
285
- min-height: 100px !important;
286
- resize: vertical !important;
287
- }
288
  }
289
-
290
  @media (min-width: 769px) and (max-width: 1024px) {
291
  .gradio-chatbot {
292
  min-height: 450px;
293
  max-height: calc(100vh - 180px);
294
  }
295
  }
296
-
297
  @media (min-width: 1025px) {
298
  .gradio-chatbot {
299
  min-height: 500px;
300
  max-height: calc(100vh - 200px);
301
  }
302
  }
303
-
304
  @media (max-height: 500px) and (orientation: landscape) {
305
  .title {
306
  font-size: 1.2rem;
@@ -312,12 +289,10 @@ with gr.Blocks(theme=theme, css="""
312
  }
313
  }
314
  """) as demo:
315
-
316
  with gr.Column(elem_classes=["main-container"]):
317
  gr.HTML("""
318
  <div class='title'>🎓 EduBot</div>
319
  """)
320
-
321
  with gr.Column(elem_classes=["chat-container"]):
322
  chatbot = gr.Chatbot(
323
  show_copy_button=True,
@@ -326,29 +301,25 @@ with gr.Blocks(theme=theme, css="""
326
  container=True,
327
  elem_classes=["gradio-chatbot"]
328
  )
329
-
330
  with gr.Row(elem_classes=["input-row"]):
331
  msg = gr.Textbox(
332
- placeholder="Ask me about math, research, study strategies, or any educational topic...",
333
- container=False,
334
- show_label=False,
335
- elem_classes=["custom-textbox"],
336
- lines=4,
337
- max_lines=8
338
- )
339
  send_btn = gr.Button("📤", variant="primary", elem_classes=["send-button"])
340
-
341
  def respond_and_update(message, history):
342
  for response in respond_with_enhanced_streaming(message, history):
343
  history.append([message, response])
344
  yield history, ""
345
-
346
  msg.submit(
347
  respond_and_update,
348
  [msg, chatbot],
349
  [chatbot, msg]
350
  )
351
-
352
  send_btn.click(
353
  respond_and_update,
354
  [msg, chatbot],
@@ -357,4 +328,4 @@ with gr.Blocks(theme=theme, css="""
357
 
358
  if __name__ == "__main__":
359
  logger.info("Starting EduBot with custom styling...")
360
- demo.launch()
 
184
  min-height: 400px;
185
  max-height: calc(100vh - 200px);
186
  }
 
187
  .chat-bot .message-wrap .avatar-container {
188
  display: none !important;
189
  }
 
194
  .gradio-chatbot .message.user .avatar-container {
195
  display: none !important;
196
  }
 
197
  .input-row {
198
  flex-shrink: 0;
199
  margin-top: 0.5rem;
 
205
  margin-left: auto;
206
  margin-right: auto;
207
  }
 
208
  .custom-textbox {
209
  flex: 1;
210
  min-width: 400px;
211
  }
 
212
  .custom-textbox > div {
213
  width: 100% !important;
214
  }
 
 
215
  .custom-textbox textarea {
216
+ border-radius: 12px !important;
217
+ border: 1pt solid #64748b !important;
218
  padding: 15px 20px !important;
219
  font-size: 16px !important;
220
  background: white !important;
221
  outline: none !important;
222
  box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
223
  transition: all 0.3s ease !important;
224
+ min-height: 100px !important;
225
+ resize: vertical !important;
226
  width: 100% !important;
 
227
  }
 
 
228
  .custom-textbox textarea:focus {
229
  border-color: #475569 !important;
230
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.1) !important;
231
  }
 
232
  .custom-textbox label {
233
  display: none !important;
234
  }
 
235
  .send-button {
236
  border-radius: 50% !important;
237
  width: 50px !important;
 
241
  justify-content: center !important;
242
  flex-shrink: 0 !important;
243
  }
 
244
  @media (max-width: 768px) {
245
  .main-container {
246
  padding: 0.5rem;
 
261
  .custom-textbox {
262
  min-width: 250px;
263
  }
264
+ .custom-textbox textarea {
265
+ min-height: 80px !important;
266
+ font-size: 14px !important;
267
+ }
 
 
 
 
 
 
 
 
268
  }
 
269
  @media (min-width: 769px) and (max-width: 1024px) {
270
  .gradio-chatbot {
271
  min-height: 450px;
272
  max-height: calc(100vh - 180px);
273
  }
274
  }
 
275
  @media (min-width: 1025px) {
276
  .gradio-chatbot {
277
  min-height: 500px;
278
  max-height: calc(100vh - 200px);
279
  }
280
  }
 
281
  @media (max-height: 500px) and (orientation: landscape) {
282
  .title {
283
  font-size: 1.2rem;
 
289
  }
290
  }
291
  """) as demo:
 
292
  with gr.Column(elem_classes=["main-container"]):
293
  gr.HTML("""
294
  <div class='title'>🎓 EduBot</div>
295
  """)
 
296
  with gr.Column(elem_classes=["chat-container"]):
297
  chatbot = gr.Chatbot(
298
  show_copy_button=True,
 
301
  container=True,
302
  elem_classes=["gradio-chatbot"]
303
  )
 
304
  with gr.Row(elem_classes=["input-row"]):
305
  msg = gr.Textbox(
306
+ placeholder="Ask me about math, research, study strategies, or any educational topic...",
307
+ container=False,
308
+ show_label=False,
309
+ elem_classes=["custom-textbox"],
310
+ lines=4,
311
+ max_lines=8
312
+ )
313
  send_btn = gr.Button("📤", variant="primary", elem_classes=["send-button"])
 
314
  def respond_and_update(message, history):
315
  for response in respond_with_enhanced_streaming(message, history):
316
  history.append([message, response])
317
  yield history, ""
 
318
  msg.submit(
319
  respond_and_update,
320
  [msg, chatbot],
321
  [chatbot, msg]
322
  )
 
323
  send_btn.click(
324
  respond_and_update,
325
  [msg, chatbot],
 
328
 
329
  if __name__ == "__main__":
330
  logger.info("Starting EduBot with custom styling...")
331
+ demo.launch()