Trabis commited on
Commit
c8ac575
·
verified ·
1 Parent(s): cb87682

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -25
app.py CHANGED
@@ -345,10 +345,10 @@ custom_css = """
345
 
346
  /* Styles généraux */
347
  :root {
348
- --primary-color: #2D3748;
349
- --secondary-color: #4A5568;
350
  --accent-color: #4299E1;
351
- --background-color: #424B5A;
352
  --border-radius: 8px;
353
  --font-family-arabic: 'Noto Sans Arabic', Arial, sans-serif;
354
  }
@@ -357,6 +357,7 @@ custom_css = """
357
  body {
358
  font-family: var(--font-family-arabic);
359
  background-color: var(--background-color);
 
360
  }
361
 
362
  /* Styles pour le texte RTL */
@@ -372,7 +373,8 @@ body {
372
  padding: 1rem !important;
373
  border-radius: var(--border-radius) !important;
374
  border: 1px solid #E2E8F0 !important;
375
- background-color: #5b5b5b !important;
 
376
  font-size: 1.1rem !important;
377
  line-height: 1.6 !important;
378
  font-family: var(--font-family-arabic) !important;
@@ -416,7 +418,7 @@ button.primary-button:hover {
416
 
417
  /* Styles des boîtes de texte */
418
  .textbox-container {
419
- background-color: #5b5b5b !important;
420
  padding: 1.5rem !important;
421
  border-radius: var(--border-radius) !important;
422
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
@@ -482,26 +484,40 @@ with gr.Blocks(css=custom_css) as iface:
482
 
483
  # status_text = gr.Markdown("", elem_classes="rtl-text status-text")
484
 
485
- def on_submit(question):
486
- # Retourne trois valeurs : réponse, contexte et statut
487
- result, context = process_question(question)
488
- status = "تمت معالجة السؤال بنجاح" # "Question processed successfully"
489
- return result, context, status
490
 
491
- submit_btn.click(
492
- fn=on_submit,
493
- inputs=input_text,
494
- outputs=[answer_box, context_box],
495
- api_name="predict",
496
- queue=True
497
- )
 
 
 
 
 
 
 
 
 
498
 
499
- if __name__ == "__main__":
500
- iface.launch(
501
- share=True,
502
- server_name="0.0.0.0",
503
- server_port=7860,
504
- max_threads=3,
505
- show_error=True
506
- )
 
 
 
 
 
507
 
 
345
 
346
  /* Styles généraux */
347
  :root {
348
+ --primary-color: #333333;
349
+ --secondary-color: #666666;
350
  --accent-color: #4299E1;
351
+ --background-color: #ffffff;
352
  --border-radius: 8px;
353
  --font-family-arabic: 'Noto Sans Arabic', Arial, sans-serif;
354
  }
 
357
  body {
358
  font-family: var(--font-family-arabic);
359
  background-color: var(--background-color);
360
+ color: var(--primary-color);
361
  }
362
 
363
  /* Styles pour le texte RTL */
 
373
  padding: 1rem !important;
374
  border-radius: var(--border-radius) !important;
375
  border: 1px solid #E2E8F0 !important;
376
+ background-color: #ffffff !important;
377
+ color: var(--primary-color) !important;
378
  font-size: 1.1rem !important;
379
  line-height: 1.6 !important;
380
  font-family: var(--font-family-arabic) !important;
 
418
 
419
  /* Styles des boîtes de texte */
420
  .textbox-container {
421
+ background-color: #ffffff !important;
422
  padding: 1.5rem !important;
423
  border-radius: var(--border-radius) !important;
424
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
 
484
 
485
  # status_text = gr.Markdown("", elem_classes="rtl-text status-text")
486
 
487
+ # def on_submit(question):
488
+ # # Retourne trois valeurs : réponse, contexte et statut
489
+ # result, context = process_question(question)
490
+ # status = "تمت معالجة السؤال بنجاح" # "Question processed successfully"
491
+ # return result, context, status
492
 
493
+ # submit_btn.click(
494
+ # fn=on_submit,
495
+ # inputs=input_text,
496
+ # outputs=[answer_box, context_box],
497
+ # api_name="predict",
498
+ # queue=True
499
+ # )
500
+
501
+ # if __name__ == "__main__":
502
+ # iface.launch(
503
+ # share=True,
504
+ # server_name="0.0.0.0",
505
+ # server_port=7860,
506
+ # max_threads=3,
507
+ # show_error=True
508
+ # )
509
 
510
+ def on_submit(question):
511
+ # Retourne trois valeurs : réponse, contexte et statut
512
+ for part in process_question(question):
513
+ answer_box.value += part
514
+ yield part, context, "Traitement en cours..."
515
+
516
+ submit_btn.click(
517
+ fn=on_submit,
518
+ inputs=input_text,
519
+ outputs=[answer_box, context_box],
520
+ api_name="predict",
521
+ queue=True
522
+ )
523