ghostai1 commited on
Commit
fd58b74
·
verified ·
1 Parent(s): 10e0809

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -15
app.py CHANGED
@@ -122,7 +122,7 @@ def plot_metrics(metrics):
122
  'Accuracy (%)': [100, metrics['accuracy'], metrics['accuracy']]
123
  })
124
 
125
- plt.figure(figsize=(8, 5))
126
  sns.set_style("whitegrid")
127
  sns.set_palette("muted")
128
 
@@ -177,15 +177,15 @@ body {
177
  background: #3a3a3a;
178
  border: 1px solid #4a4a4a;
179
  border-radius: 8px;
180
- padding: 15px;
181
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
182
  }
183
  .gr-button {
184
  background: #1e90ff;
185
  color: white;
186
  border-radius: 5px;
187
- padding: 10px 20px;
188
- margin: 5px 0;
189
  width: 100%;
190
  text-align: center;
191
  transition: background 0.3s ease;
@@ -200,11 +200,19 @@ body {
200
  color: #e0e0e0;
201
  border: 1px solid #4a4a4a;
202
  border-radius: 5px;
203
- margin-bottom: 10px;
204
- font-size: 14px;
 
 
 
 
 
 
 
 
205
  }
206
  #app-container {
207
- max-width: 800px;
208
  width: 100%;
209
  padding: 20px;
210
  background: #252525;
@@ -214,18 +222,18 @@ body {
214
  #button-container {
215
  display: flex;
216
  flex-direction: column;
217
- gap: 10px;
218
- padding: 15px;
219
  background: #303030;
220
  border-radius: 8px;
221
  align-items: center;
222
- width: 100%;
223
  }
224
  #output-container {
225
  background: #303030;
226
- padding: 15px;
227
  border-radius: 8px;
228
- width: 100%;
229
  }
230
  .text-center {
231
  text-align: center;
@@ -233,8 +241,9 @@ body {
233
  }
234
  #app-row {
235
  display: flex;
236
- gap: 20px;
237
  justify-content: space-between;
 
238
  }
239
  """
240
 
@@ -249,14 +258,14 @@ with gr.Blocks(css=custom_css) as demo:
249
  # Layout: outputs on left, buttons on right
250
  with gr.Row(elem_id="app-row"):
251
  # Single output panel (left 2/3)
252
- with gr.Column(elem_id="output-container"):
253
  response_output = gr.Textbox(label="Bot Response", elem_id="response-output")
254
  faq_output = gr.Textbox(label="Retrieved FAQs", elem_id="faq-output")
255
  cleanup_output = gr.Textbox(label="Data Cleanup Stats", elem_id="cleanup-output")
256
  plot_output = gr.Image(label="RAG Pipeline Metrics", elem_id="plot-output")
257
 
258
  # Stacked buttons (right 1/3)
259
- with gr.Column(elem_id="button-container"):
260
  for question in unique_questions:
261
  gr.Button(question).click(
262
  fn=chat_interface,
 
122
  'Accuracy (%)': [100, metrics['accuracy'], metrics['accuracy']]
123
  })
124
 
125
+ plt.figure(figsize=(10, 6)) # Increased size for better readability
126
  sns.set_style("whitegrid")
127
  sns.set_palette("muted")
128
 
 
177
  background: #3a3a3a;
178
  border: 1px solid #4a4a4a;
179
  border-radius: 8px;
180
+ padding: 20px; /* Increased padding for better spacing */
181
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
182
  }
183
  .gr-button {
184
  background: #1e90ff;
185
  color: white;
186
  border-radius: 5px;
187
+ padding: 12px 20px; /* Slightly larger padding for buttons */
188
+ margin: 8px 0; /* Increased margin for better spacing */
189
  width: 100%;
190
  text-align: center;
191
  transition: background 0.3s ease;
 
200
  color: #e0e0e0;
201
  border: 1px solid #4a4a4a;
202
  border-radius: 5px;
203
+ margin-bottom: 15px; /* Increased margin for better spacing */
204
+ font-size: 16px; /* Larger font size for readability */
205
+ padding: 15px; /* Increased padding for larger textboxes */
206
+ min-height: 120px; /* Increased height for better readability */
207
+ width: 100%; /* Ensure full width */
208
+ }
209
+ .gr-image {
210
+ width: 100%; /* Ensure the plot takes full width of container */
211
+ height: auto; /* Maintain aspect ratio */
212
+ max-height: 400px; /* Increased max height for larger plot */
213
  }
214
  #app-container {
215
+ max-width: 900px; /* Slightly wider container for better balance */
216
  width: 100%;
217
  padding: 20px;
218
  background: #252525;
 
222
  #button-container {
223
  display: flex;
224
  flex-direction: column;
225
+ gap: 15px; /* Increased gap for better spacing */
226
+ padding: 20px; /* Increased padding for better alignment */
227
  background: #303030;
228
  border-radius: 8px;
229
  align-items: center;
230
+ width: 100%; /* Full width within parent column */
231
  }
232
  #output-container {
233
  background: #303030;
234
+ padding: 20px; /* Increased padding for larger output fields */
235
  border-radius: 8px;
236
+ width: 100%; /* Full width within parent column */
237
  }
238
  .text-center {
239
  text-align: center;
 
241
  }
242
  #app-row {
243
  display: flex;
244
+ gap: 30px; /* Increased gap for better separation */
245
  justify-content: space-between;
246
+ align-items: stretch; /* Ensure columns stretch to same height */
247
  }
248
  """
249
 
 
258
  # Layout: outputs on left, buttons on right
259
  with gr.Row(elem_id="app-row"):
260
  # Single output panel (left 2/3)
261
+ with gr.Column(elem_id="output-container", scale=2): # Increased scale for larger output area
262
  response_output = gr.Textbox(label="Bot Response", elem_id="response-output")
263
  faq_output = gr.Textbox(label="Retrieved FAQs", elem_id="faq-output")
264
  cleanup_output = gr.Textbox(label="Data Cleanup Stats", elem_id="cleanup-output")
265
  plot_output = gr.Image(label="RAG Pipeline Metrics", elem_id="plot-output")
266
 
267
  # Stacked buttons (right 1/3)
268
+ with gr.Column(elem_id="button-container", scale=1): # Adjusted scale for buttons
269
  for question in unique_questions:
270
  gr.Button(question).click(
271
  fn=chat_interface,