xuandin commited on
Commit
4ab50fb
·
verified ·
1 Parent(s): 3790c8a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +190 -69
app.py CHANGED
@@ -160,178 +160,295 @@ st.markdown("""
160
  <style>
161
  /* Main theme colors */
162
  :root {
163
- --primary-color: #1f77b4;
164
- --secondary-color: #2c3e50;
165
  --accent-color: #e74c3c;
 
 
166
  --background-color: #f8f9fa;
167
  --text-color: #2c3e50;
168
  --border-color: #e0e0e0;
 
 
169
  }
170
 
171
  /* General styling */
172
  .stApp {
173
  background-color: var(--background-color);
174
  color: var(--text-color);
 
175
  }
176
 
177
  /* Header styling */
178
  .main-header {
179
- background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
180
  color: white;
181
- padding: 2rem;
182
- border-radius: 10px;
183
  margin-bottom: 2rem;
184
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  }
186
 
187
  .main-title {
188
- font-size: 2.5rem;
189
- font-weight: bold;
190
  text-align: center;
191
  margin-bottom: 1rem;
 
 
192
  }
193
 
194
  .sub-title {
195
- font-size: 1.2rem;
196
  text-align: center;
197
  opacity: 0.9;
 
198
  }
199
 
200
  /* Input styling */
201
  .stTextArea textarea {
202
  border: 2px solid var(--border-color);
203
- border-radius: 8px;
204
- padding: 1rem;
205
- font-size: 1rem;
206
  min-height: 150px;
207
  background-color: white;
 
 
 
 
 
 
 
208
  }
209
 
210
  /* Button styling */
211
  .stButton>button {
212
- background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
213
  color: white;
214
  border: none;
215
- border-radius: 8px;
216
- padding: 0.8rem 2rem;
217
- font-size: 1.1rem;
218
- font-weight: bold;
219
  transition: all 0.3s ease;
 
 
220
  }
221
 
222
  .stButton>button:hover {
223
  transform: translateY(-2px);
224
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
225
  }
226
 
227
  /* Result box styling */
228
  .result-box {
229
  background-color: white;
230
- border-radius: 12px;
231
- padding: 2rem;
232
- margin: 1rem 0;
233
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
 
 
 
 
 
 
 
234
  }
235
 
236
  .verdict {
237
- font-size: 1.8rem;
238
- font-weight: bold;
239
- padding: 1rem;
240
- border-radius: 8px;
241
- margin: 1rem 0;
242
  text-align: center;
 
243
  }
244
 
245
  .verdict-supported {
246
- background-color: #d4edda;
247
- color: #155724;
 
248
  }
249
 
250
  .verdict-refuted {
251
- background-color: #f8d7da;
252
- color: #721c24;
 
253
  }
254
 
255
  .verdict-nei {
256
- background-color: #fff3cd;
257
- color: #856404;
 
258
  }
259
 
260
  /* Sidebar styling */
261
  .css-1d391kg {
262
  background-color: white;
263
- padding: 2rem;
264
- border-radius: 12px;
265
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
266
  }
267
 
268
  /* Stats box styling */
269
  .stats-box {
270
- background-color: white;
271
- border-radius: 8px;
272
- padding: 1rem;
273
- margin: 0.5rem 0;
274
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
275
  }
276
 
277
  /* Code block styling */
278
  .code-block {
279
- background-color: #f8f9fa;
280
- border: 1px solid var(--border-color);
281
- border-radius: 8px;
282
- padding: 1rem;
283
- font-family: monospace;
284
- margin: 1rem 0;
 
285
  }
286
 
287
  /* Tab styling */
288
  .stTabs [data-baseweb="tab-list"] {
289
  gap: 2rem;
 
290
  }
291
 
292
  .stTabs [data-baseweb="tab"] {
293
  background-color: white;
294
- border-radius: 8px;
295
- padding: 0.5rem 1rem;
296
  margin: 0 0.5rem;
 
 
 
297
  }
298
 
299
  .stTabs [aria-selected="true"] {
300
- background-color: var(--primary-color);
301
  color: white;
 
302
  }
303
 
304
  /* Analysis box styling */
305
  .analysis-box {
306
  background-color: white;
307
- border-radius: 12px;
308
- padding: 1.5rem;
309
- margin: 1rem 0;
310
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
 
311
  }
312
 
313
  /* Search box styling */
314
  .search-box {
315
  background-color: white;
316
- border-radius: 8px;
317
- padding: 1rem;
318
- margin-bottom: 1rem;
319
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
320
  }
321
 
322
  /* Comparison box styling */
323
  .comparison-box {
324
  background-color: white;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
  border-radius: 12px;
326
- padding: 1.5rem;
327
- margin: 1rem 0;
328
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
329
- border-left: 4px solid var(--primary-color);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
330
  }
331
  </style>
332
  """, unsafe_allow_html=True)
333
 
334
- # Main header
335
  st.markdown("""
336
  <div class="main-header">
337
  <div class="main-title">SemViQA</div>
@@ -339,11 +456,15 @@ st.markdown("""
339
  </div>
340
  """, unsafe_allow_html=True)
341
 
342
- # Sidebar
343
  with st.sidebar:
344
- st.markdown("### ⚙️ Cài đặt Hệ thống")
 
 
 
 
345
 
346
- # Model selection
347
  st.markdown("#### 🧠 Chọn Mô hình")
348
  qatc_model_name = st.selectbox(
349
  "Mô hình QATC",
@@ -379,7 +500,7 @@ with st.sidebar:
379
  ]
380
  )
381
 
382
- # Threshold settings
383
  st.markdown("#### ⚖️ Ngưỡng Phân tích")
384
  tfidf_threshold = st.slider(
385
  "Ngưỡng TF-IDF",
@@ -393,7 +514,7 @@ with st.sidebar:
393
  help="Điều chỉnh độ dài tối đa của bằng chứng"
394
  )
395
 
396
- # Display settings
397
  st.markdown("#### 👁️ Hiển thị")
398
  show_details = st.checkbox(
399
  "Hiển thị Chi tiết Xác suất",
@@ -401,7 +522,7 @@ with st.sidebar:
401
  help="Hiển thị thông tin chi tiết về xác suất dự đoán"
402
  )
403
 
404
- # Performance settings
405
  st.markdown("#### ⚡ Hiệu suất")
406
  num_threads = st.slider(
407
  "Số luồng CPU",
 
160
  <style>
161
  /* Main theme colors */
162
  :root {
163
+ --primary-color: #2c3e50;
164
+ --secondary-color: #3498db;
165
  --accent-color: #e74c3c;
166
+ --success-color: #2ecc71;
167
+ --warning-color: #f1c40f;
168
  --background-color: #f8f9fa;
169
  --text-color: #2c3e50;
170
  --border-color: #e0e0e0;
171
+ --gradient-start: #2c3e50;
172
+ --gradient-end: #3498db;
173
  }
174
 
175
  /* General styling */
176
  .stApp {
177
  background-color: var(--background-color);
178
  color: var(--text-color);
179
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
180
  }
181
 
182
  /* Header styling */
183
  .main-header {
184
+ background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
185
  color: white;
186
+ padding: 3rem 2rem;
187
+ border-radius: 15px;
188
  margin-bottom: 2rem;
189
+ box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
190
+ position: relative;
191
+ overflow: hidden;
192
+ }
193
+
194
+ .main-header::before {
195
+ content: '';
196
+ position: absolute;
197
+ top: 0;
198
+ left: 0;
199
+ right: 0;
200
+ bottom: 0;
201
+ background: url('data:image/svg+xml,<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" fill="rgba(255,255,255,0.05)"/></svg>');
202
+ opacity: 0.1;
203
  }
204
 
205
  .main-title {
206
+ font-size: 3rem;
207
+ font-weight: 800;
208
  text-align: center;
209
  margin-bottom: 1rem;
210
+ text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
211
+ letter-spacing: 1px;
212
  }
213
 
214
  .sub-title {
215
+ font-size: 1.4rem;
216
  text-align: center;
217
  opacity: 0.9;
218
+ font-weight: 300;
219
  }
220
 
221
  /* Input styling */
222
  .stTextArea textarea {
223
  border: 2px solid var(--border-color);
224
+ border-radius: 12px;
225
+ padding: 1.2rem;
226
+ font-size: 1.1rem;
227
  min-height: 150px;
228
  background-color: white;
229
+ transition: all 0.3s ease;
230
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
231
+ }
232
+
233
+ .stTextArea textarea:focus {
234
+ border-color: var(--secondary-color);
235
+ box-shadow: 0 4px 8px rgba(52, 152, 219, 0.1);
236
  }
237
 
238
  /* Button styling */
239
  .stButton>button {
240
+ background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
241
  color: white;
242
  border: none;
243
+ border-radius: 12px;
244
+ padding: 1rem 2.5rem;
245
+ font-size: 1.2rem;
246
+ font-weight: 600;
247
  transition: all 0.3s ease;
248
+ text-transform: uppercase;
249
+ letter-spacing: 1px;
250
  }
251
 
252
  .stButton>button:hover {
253
  transform: translateY(-2px);
254
+ box-shadow: 0 8px 16px rgba(52, 152, 219, 0.2);
255
  }
256
 
257
  /* Result box styling */
258
  .result-box {
259
  background-color: white;
260
+ border-radius: 15px;
261
+ padding: 2.5rem;
262
+ margin: 1.5rem 0;
263
+ box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
264
+ transition: all 0.3s ease;
265
+ border: 1px solid rgba(0, 0, 0, 0.05);
266
+ }
267
+
268
+ .result-box:hover {
269
+ transform: translateY(-2px);
270
+ box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
271
  }
272
 
273
  .verdict {
274
+ font-size: 2rem;
275
+ font-weight: 800;
276
+ padding: 1.5rem;
277
+ border-radius: 12px;
278
+ margin: 1.5rem 0;
279
  text-align: center;
280
+ transition: all 0.3s ease;
281
  }
282
 
283
  .verdict-supported {
284
+ background: linear-gradient(135deg, #2ecc71, #27ae60);
285
+ color: white;
286
+ box-shadow: 0 4px 8px rgba(46, 204, 113, 0.2);
287
  }
288
 
289
  .verdict-refuted {
290
+ background: linear-gradient(135deg, #e74c3c, #c0392b);
291
+ color: white;
292
+ box-shadow: 0 4px 8px rgba(231, 76, 60, 0.2);
293
  }
294
 
295
  .verdict-nei {
296
+ background: linear-gradient(135deg, #f1c40f, #f39c12);
297
+ color: white;
298
+ box-shadow: 0 4px 8px rgba(241, 196, 15, 0.2);
299
  }
300
 
301
  /* Sidebar styling */
302
  .css-1d391kg {
303
  background-color: white;
304
+ padding: 2.5rem;
305
+ border-radius: 15px;
306
+ box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
307
  }
308
 
309
  /* Stats box styling */
310
  .stats-box {
311
+ background: linear-gradient(135deg, #f8f9fa, #e9ecef);
312
+ border-radius: 12px;
313
+ padding: 1.5rem;
314
+ margin: 1rem 0;
315
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
316
  }
317
 
318
  /* Code block styling */
319
  .code-block {
320
+ background-color: #2c3e50;
321
+ border-radius: 12px;
322
+ padding: 1.5rem;
323
+ font-family: 'Fira Code', monospace;
324
+ margin: 1.5rem 0;
325
+ color: #ecf0f1;
326
+ overflow-x: auto;
327
  }
328
 
329
  /* Tab styling */
330
  .stTabs [data-baseweb="tab-list"] {
331
  gap: 2rem;
332
+ background-color: transparent;
333
  }
334
 
335
  .stTabs [data-baseweb="tab"] {
336
  background-color: white;
337
+ border-radius: 12px;
338
+ padding: 0.8rem 1.5rem;
339
  margin: 0 0.5rem;
340
+ font-weight: 600;
341
+ transition: all 0.3s ease;
342
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
343
  }
344
 
345
  .stTabs [aria-selected="true"] {
346
+ background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
347
  color: white;
348
+ box-shadow: 0 4px 8px rgba(52, 152, 219, 0.2);
349
  }
350
 
351
  /* Analysis box styling */
352
  .analysis-box {
353
  background-color: white;
354
+ border-radius: 15px;
355
+ padding: 2rem;
356
+ margin: 1.5rem 0;
357
+ box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
358
+ border-left: 4px solid var(--secondary-color);
359
  }
360
 
361
  /* Search box styling */
362
  .search-box {
363
  background-color: white;
364
+ border-radius: 12px;
365
+ padding: 1.5rem;
366
+ margin-bottom: 1.5rem;
367
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
368
  }
369
 
370
  /* Comparison box styling */
371
  .comparison-box {
372
  background-color: white;
373
+ border-radius: 15px;
374
+ padding: 2rem;
375
+ margin: 1.5rem 0;
376
+ box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
377
+ border-left: 4px solid var(--secondary-color);
378
+ }
379
+
380
+ /* Selectbox styling */
381
+ .stSelectbox select {
382
+ border-radius: 8px;
383
+ padding: 0.8rem;
384
+ font-size: 1rem;
385
+ border: 2px solid var(--border-color);
386
+ background-color: white;
387
+ transition: all 0.3s ease;
388
+ }
389
+
390
+ .stSelectbox select:focus {
391
+ border-color: var(--secondary-color);
392
+ box-shadow: 0 4px 8px rgba(52, 152, 219, 0.1);
393
+ }
394
+
395
+ /* Slider styling */
396
+ .stSlider > div > div {
397
+ background-color: var(--secondary-color);
398
+ }
399
+
400
+ /* Checkbox styling */
401
+ .stCheckbox > label {
402
+ font-weight: 500;
403
+ }
404
+
405
+ /* Info box styling */
406
+ .info-box {
407
+ background: linear-gradient(135deg, #f8f9fa, #e9ecef);
408
+ border-radius: 15px;
409
+ padding: 2rem;
410
+ margin: 1.5rem 0;
411
+ box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
412
+ }
413
+
414
+ /* Chart container styling */
415
+ .js-plotly-plot {
416
+ border-radius: 12px !important;
417
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05) !important;
418
+ }
419
+
420
+ /* Dataframe styling */
421
+ .dataframe {
422
  border-radius: 12px;
423
+ overflow: hidden;
424
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
425
+ }
426
+
427
+ .dataframe thead th {
428
+ background-color: var(--primary-color);
429
+ color: white;
430
+ }
431
+
432
+ /* Download button styling */
433
+ .stDownloadButton > button {
434
+ background: linear-gradient(135deg, var(--success-color), #27ae60);
435
+ color: white;
436
+ border: none;
437
+ border-radius: 12px;
438
+ padding: 0.8rem 2rem;
439
+ font-size: 1.1rem;
440
+ font-weight: 600;
441
+ transition: all 0.3s ease;
442
+ }
443
+
444
+ .stDownloadButton > button:hover {
445
+ transform: translateY(-2px);
446
+ box-shadow: 0 4px 8px rgba(46, 204, 113, 0.2);
447
  }
448
  </style>
449
  """, unsafe_allow_html=True)
450
 
451
+ # Main header with updated design
452
  st.markdown("""
453
  <div class="main-header">
454
  <div class="main-title">SemViQA</div>
 
456
  </div>
457
  """, unsafe_allow_html=True)
458
 
459
+ # Sidebar with updated design
460
  with st.sidebar:
461
+ st.markdown("""
462
+ <div class="info-box">
463
+ <h3>⚙️ Cài đặt Hệ thống</h3>
464
+ </div>
465
+ """, unsafe_allow_html=True)
466
 
467
+ # Model selection with updated styling
468
  st.markdown("#### 🧠 Chọn Mô hình")
469
  qatc_model_name = st.selectbox(
470
  "Mô hình QATC",
 
500
  ]
501
  )
502
 
503
+ # Threshold settings with updated styling
504
  st.markdown("#### ⚖️ Ngưỡng Phân tích")
505
  tfidf_threshold = st.slider(
506
  "Ngưỡng TF-IDF",
 
514
  help="Điều chỉnh độ dài tối đa của bằng chứng"
515
  )
516
 
517
+ # Display settings with updated styling
518
  st.markdown("#### 👁️ Hiển thị")
519
  show_details = st.checkbox(
520
  "Hiển thị Chi tiết Xác suất",
 
522
  help="Hiển thị thông tin chi tiết về xác suất dự đoán"
523
  )
524
 
525
+ # Performance settings with updated styling
526
  st.markdown("#### ⚡ Hiệu suất")
527
  num_threads = st.slider(
528
  "Số luồng CPU",