jdesiree commited on
Commit
93fb310
·
verified ·
1 Parent(s): c710ae2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -29
app.py CHANGED
@@ -174,11 +174,11 @@ def respond_with_enhanced_streaming(message, history):
174
  custom_css = """
175
  /* Main container and background - full viewport */
176
  .gradio-container {
 
177
  background-color: rgb(240, 236, 230) !important;
178
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
179
- height: 100vh !important;
180
  width: 100vw !important;
181
- overflow: hidden;
182
  margin: 0 !important;
183
  padding: 0 !important;
184
  max-width: none !important;
@@ -186,17 +186,16 @@ custom_css = """
186
 
187
  /* Main layout container - full width, sectioned heights */
188
  .main-container {
189
- width: 98vw; /* Sets the width to 98% of the viewport width */
190
- height: 100vh; /* Fill the entire viewport height */
191
- margin: 0 auto; /* Center the container horizontally */
192
  display: flex;
193
  flex-direction: column;
194
  }
195
 
196
- /* Section 1: Title section - 15% of viewport height */
197
  .title-section {
198
- height: 15vh;
199
- width: 100vw;
200
  padding: 1rem 2rem;
201
  background-color: rgb(240, 236, 230);
202
  border-bottom: 2px solid rgba(28, 18, 5, 0.1);
@@ -216,21 +215,19 @@ custom_css = """
216
  width: 100%;
217
  }
218
 
219
- /* Section 2: Chat content area - 60% of viewport height */
220
  .chat-content {
221
- height: 60vh;
222
- width: 100vw;
223
  display: flex;
224
  flex-direction: column;
225
- overflow: hidden;
226
  max-width: none !important;
227
  margin: 0 !important;
228
  padding: 0 !important;
229
  background-color: rgb(240, 236, 230);
230
- flex-shrink: 0;
231
  }
232
 
233
- /* Chatbot styling - uses full 60vh */
234
  .gradio-chatbot {
235
  height: 100% !important;
236
  overflow-y: auto;
@@ -280,9 +277,9 @@ custom_css = """
280
  display: none !important;
281
  }
282
 
283
- /* Section 3: Input section - 25% of viewport height */
284
  .input-section {
285
- height: 25vh;
286
  width: 100vw;
287
  background-color: rgb(240, 236, 230);
288
  border-top: 2px solid rgba(28, 18, 5, 0.1);
@@ -295,21 +292,17 @@ custom_css = """
295
  flex-shrink: 0;
296
  }
297
 
298
- /* Input textbox styling - takes most of the 25vh */
299
  .input-container {
300
  width: 100% !important;
301
  max-width: none !important;
302
  flex: 1;
303
  display: flex;
304
  align-items: center;
305
- }
306
-
307
- .input-container .wrap {
308
  background-color: rgb(242, 238, 233) !important;
309
  border: 2px solid rgb(28, 18, 5) !important;
310
  border-radius: 20px !important;
311
  box-shadow: none !important;
312
- width: 100% !important;
313
  min-height: 60px;
314
  max-height: calc(25vh - 4rem);
315
  }
@@ -325,7 +318,6 @@ custom_css = """
325
  width: 100% !important;
326
  resize: none !important;
327
  min-height: 30px;
328
- max-height: calc(25vh - 6rem);
329
  }
330
 
331
  .input-container textarea:focus {
@@ -370,20 +362,16 @@ custom_css = """
370
  .title-section, .input-section {
371
  overflow: hidden;
372
  }
373
-
374
- .chat-content {
375
- overflow: hidden;
376
- }
377
  """
378
 
379
  with gr.Blocks(css=custom_css, title="EduBot") as demo:
380
  with gr.Column(elem_classes=["main-container"]):
381
 
382
- # Section 1: Title Box - 15% of viewport height
383
  with gr.Column(elem_classes=["title-section"]):
384
  gr.HTML('<div class="model-name">🎓 EduBot</div>')
385
 
386
- # Section 2: Chat History/Conversation Viewport - 60% of viewport height
387
  with gr.Column(elem_classes=["chat-content"]):
388
  chatbot = gr.Chatbot(
389
  type="messages",
@@ -392,7 +380,7 @@ with gr.Blocks(css=custom_css, title="EduBot") as demo:
392
  avatar_images=None
393
  )
394
 
395
- # Section 3: Text Box/Clear Button - 25% of viewport height
396
  with gr.Column(elem_classes=["input-section"]):
397
  clear = gr.Button("Clear", elem_classes=["clear-btn"])
398
  msg = gr.Textbox(
 
174
  custom_css = """
175
  /* Main container and background - full viewport */
176
  .gradio-container {
177
+ height: 100vh;
178
  background-color: rgb(240, 236, 230) !important;
179
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
 
180
  width: 100vw !important;
181
+ overflow: auto;
182
  margin: 0 !important;
183
  padding: 0 !important;
184
  max-width: none !important;
 
186
 
187
  /* Main layout container - full width, sectioned heights */
188
  .main-container {
189
+ width: 98vw;
190
+ height: 100vh;
191
+ margin: 0 auto;
192
  display: flex;
193
  flex-direction: column;
194
  }
195
 
196
+ /* Section 1: Title section */
197
  .title-section {
198
+ flex: 0 0 15vh;
 
199
  padding: 1rem 2rem;
200
  background-color: rgb(240, 236, 230);
201
  border-bottom: 2px solid rgba(28, 18, 5, 0.1);
 
215
  width: 100%;
216
  }
217
 
218
+ /* Section 2: Chat content area */
219
  .chat-content {
220
+ flex: 1 1 60vh;
 
221
  display: flex;
222
  flex-direction: column;
223
+ overflow: auto;
224
  max-width: none !important;
225
  margin: 0 !important;
226
  padding: 0 !important;
227
  background-color: rgb(240, 236, 230);
 
228
  }
229
 
230
+ /* Chatbot styling */
231
  .gradio-chatbot {
232
  height: 100% !important;
233
  overflow-y: auto;
 
277
  display: none !important;
278
  }
279
 
280
+ /* Section 3: Input section */
281
  .input-section {
282
+ flex: 0 0 25vh;
283
  width: 100vw;
284
  background-color: rgb(240, 236, 230);
285
  border-top: 2px solid rgba(28, 18, 5, 0.1);
 
292
  flex-shrink: 0;
293
  }
294
 
295
+ /* Input textbox styling */
296
  .input-container {
297
  width: 100% !important;
298
  max-width: none !important;
299
  flex: 1;
300
  display: flex;
301
  align-items: center;
 
 
 
302
  background-color: rgb(242, 238, 233) !important;
303
  border: 2px solid rgb(28, 18, 5) !important;
304
  border-radius: 20px !important;
305
  box-shadow: none !important;
 
306
  min-height: 60px;
307
  max-height: calc(25vh - 4rem);
308
  }
 
318
  width: 100% !important;
319
  resize: none !important;
320
  min-height: 30px;
 
321
  }
322
 
323
  .input-container textarea:focus {
 
362
  .title-section, .input-section {
363
  overflow: hidden;
364
  }
 
 
 
 
365
  """
366
 
367
  with gr.Blocks(css=custom_css, title="EduBot") as demo:
368
  with gr.Column(elem_classes=["main-container"]):
369
 
370
+ # Section 1: Title Box
371
  with gr.Column(elem_classes=["title-section"]):
372
  gr.HTML('<div class="model-name">🎓 EduBot</div>')
373
 
374
+ # Section 2: Chat History/Conversation Viewport
375
  with gr.Column(elem_classes=["chat-content"]):
376
  chatbot = gr.Chatbot(
377
  type="messages",
 
380
  avatar_images=None
381
  )
382
 
383
+ # Section 3: Text Box/Clear Button
384
  with gr.Column(elem_classes=["input-section"]):
385
  clear = gr.Button("Clear", elem_classes=["clear-btn"])
386
  msg = gr.Textbox(