MrFrijo commited on
Commit
3d9bc3d
·
verified ·
1 Parent(s): ece2403

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -17
app.py CHANGED
@@ -20,31 +20,55 @@ def translate_text(text, src_lang, target_lang):
20
 
21
  # Créer l'interface Gradio
22
  with gr.Blocks() as interface:
23
- # Section d'en-tête
24
- gr.Markdown("<h2>Traduction automatique Lingala-Français</h2>")
25
  gr.Markdown("""
26
- <p>Ceci est la version d'essai et nous comptons sur vous pour améliorer les performances du modèle pour notre langue Lingala.</p>
27
- <p>Oyo e za version ya komeka pe to zo talela bino pôna ko kolisa bokasi ya modeli pôna nkota nà biso Lingala.</p>
 
 
 
28
  """)
29
 
30
- # Entrée de traduction
31
- with gr.Row():
32
- text_input = gr.Textbox(label="Entrez le texte à traduire", placeholder="Entrez le texte à traduire ici...")
33
-
34
- with gr.Row():
35
- source_lang = gr.Dropdown(choices=["fr", "li"], label="Langue Source")
36
- target_lang = gr.Dropdown(choices=["li", "fr"], label="Langue Cible")
37
-
38
- # Sortie de traduction
39
- translation_output = gr.Textbox(label="Traduction", placeholder="Le texte traduit s'affichera ici...")
40
-
41
- # Bouton pour soumettre
42
- translate_button = gr.Button("Traduire")
 
 
 
43
  translate_button.click(
44
  translate_text,
45
  inputs=[text_input, source_lang, target_lang],
46
  outputs=translation_output
47
  )
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  # Lancer l'interface
50
  interface.launch()
 
20
 
21
  # Créer l'interface Gradio
22
  with gr.Blocks() as interface:
23
+ # Titre et description
 
24
  gr.Markdown("""
25
+ <div style="text-align: center;">
26
+ <h2>Traduction automatique Lingala-Français</h2>
27
+ <p>Ceci est la version d'essai et nous comptons sur vous pour améliorer les performances du modèle pour notre langue Lingala.</p>
28
+ <p>Oyo e za version ya komeka pe to zo talela bino pôna ko kolisa makoki ya modeli pôna nkota nà biso Lingala.</p>
29
+ </div>
30
  """)
31
 
32
+ # Création du formulaire centré dans un conteneur avec un contour
33
+ with gr.Box(elem_id="form-container"):
34
+ with gr.Row(variant="panel", align="center"):
35
+ text_input = gr.Textbox(label="Entrez le texte à traduire", placeholder="Entrez le texte à traduire ici...", lines=3)
36
+
37
+ with gr.Row(variant="panel", align="center"):
38
+ source_lang = gr.Dropdown(choices=["fr", "li"], label="Langue Source")
39
+ target_lang = gr.Dropdown(choices=["li", "fr"], label="Langue Cible")
40
+
41
+ with gr.Row(variant="panel", align="center"):
42
+ translate_button = gr.Button("Traduire")
43
+
44
+ with gr.Row(variant="panel", align="center"):
45
+ translation_output = gr.Textbox(label="Traduction", placeholder="Le texte traduit s'affichera ici...")
46
+
47
+ # Lancer la traduction avec le bouton
48
  translate_button.click(
49
  translate_text,
50
  inputs=[text_input, source_lang, target_lang],
51
  outputs=translation_output
52
  )
53
 
54
+ # Personnalisation CSS pour la boîte et l'alignement
55
+ interface.css = """
56
+ #form-container {
57
+ width: 50%;
58
+ margin: auto;
59
+ padding: 20px;
60
+ border: 2px solid #ddd;
61
+ border-radius: 10px;
62
+ background-color: #f9f9f9;
63
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
64
+ }
65
+ #form-container .row {
66
+ margin-bottom: 15px;
67
+ }
68
+ #form-container .button {
69
+ width: 100%;
70
+ }
71
+ """
72
+
73
  # Lancer l'interface
74
  interface.launch()