Update app.py
Browse files
app.py
CHANGED
|
@@ -19,15 +19,32 @@ def translate_text(text, src_lang, target_lang):
|
|
| 19 |
return translated_text
|
| 20 |
|
| 21 |
# Créer l'interface Gradio
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
# Lancer l'interface
|
| 33 |
interface.launch()
|
|
|
|
| 19 |
return translated_text
|
| 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()
|