Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
from transformers import MarianMTModel, MarianTokenizer
|
| 3 |
|
| 4 |
# Charger le modèle et le tokenizer depuis Hugging Face
|
|
@@ -29,14 +29,17 @@ with gr.Blocks() as interface:
|
|
| 29 |
</div>
|
| 30 |
""")
|
| 31 |
|
| 32 |
-
# Créer une colonne
|
| 33 |
with gr.Column():
|
| 34 |
text_input = gr.Textbox(label="Entrez le texte à traduire", placeholder="Entrez le texte à traduire ici...", lines=3)
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
translation_output = gr.Textbox(label="Traduction", placeholder="Le texte traduit s'affichera ici...")
|
| 38 |
translate_button = gr.Button("Traduire")
|
| 39 |
-
|
| 40 |
|
| 41 |
# Lier le bouton au processus de traduction
|
| 42 |
translate_button.click(
|
|
@@ -62,15 +65,18 @@ interface.css = """
|
|
| 62 |
width:100%;
|
| 63 |
flex-wrap: wrap;
|
| 64 |
}
|
|
|
|
|
|
|
| 65 |
.gradio-button {
|
| 66 |
-
background-color: #
|
| 67 |
color: white;
|
| 68 |
border-radius: 5px;
|
| 69 |
border: none;
|
| 70 |
}
|
| 71 |
.gradio-button:hover {
|
| 72 |
-
background-color: #
|
| 73 |
}
|
|
|
|
| 74 |
.gr-markdown {
|
| 75 |
font-family: 'Lobster', sans-serif;
|
| 76 |
font-size: 24px;
|
|
@@ -79,6 +85,7 @@ interface.css = """
|
|
| 79 |
.gradio-row {
|
| 80 |
margin-top: 10px;
|
| 81 |
}
|
|
|
|
| 82 |
/* Centrer la colonne et ajouter un style à la zone de texte */
|
| 83 |
.gr-column {
|
| 84 |
width: 50%;
|
|
@@ -89,11 +96,13 @@ interface.css = """
|
|
| 89 |
background-color: #f9f9f9;
|
| 90 |
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
| 91 |
}
|
|
|
|
| 92 |
/* Appliquer un style pour le texte d'entrée */
|
| 93 |
.gr-textbox {
|
| 94 |
font-size: 16px;
|
| 95 |
padding: 10px;
|
| 96 |
}
|
|
|
|
| 97 |
/* Appliquer un style pour la sortie de traduction */
|
| 98 |
.gr-textbox[placeholder='Le texte traduit s\'affichera ici...'] {
|
| 99 |
font-size: 16px;
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
from transformers import MarianMTModel, MarianTokenizer
|
| 3 |
|
| 4 |
# Charger le modèle et le tokenizer depuis Hugging Face
|
|
|
|
| 29 |
</div>
|
| 30 |
""")
|
| 31 |
|
| 32 |
+
# Créer une colonne
|
| 33 |
with gr.Column():
|
| 34 |
text_input = gr.Textbox(label="Entrez le texte à traduire", placeholder="Entrez le texte à traduire ici...", lines=3)
|
| 35 |
+
|
| 36 |
+
# Utilisation d'un Row pour mettre les deux Dropdown sur la même ligne
|
| 37 |
+
with gr.Row():
|
| 38 |
+
source_lang = gr.Dropdown(choices=["fr", "li"], label="Langue Source")
|
| 39 |
+
target_lang = gr.Dropdown(choices=["li", "fr"], label="Langue Cible")
|
| 40 |
+
|
| 41 |
translation_output = gr.Textbox(label="Traduction", placeholder="Le texte traduit s'affichera ici...")
|
| 42 |
translate_button = gr.Button("Traduire")
|
|
|
|
| 43 |
|
| 44 |
# Lier le bouton au processus de traduction
|
| 45 |
translate_button.click(
|
|
|
|
| 65 |
width:100%;
|
| 66 |
flex-wrap: wrap;
|
| 67 |
}
|
| 68 |
+
|
| 69 |
+
/* Bouton avec couleur orangée */
|
| 70 |
.gradio-button {
|
| 71 |
+
background-color: #FFA500;
|
| 72 |
color: white;
|
| 73 |
border-radius: 5px;
|
| 74 |
border: none;
|
| 75 |
}
|
| 76 |
.gradio-button:hover {
|
| 77 |
+
background-color: #FF7F00;
|
| 78 |
}
|
| 79 |
+
|
| 80 |
.gr-markdown {
|
| 81 |
font-family: 'Lobster', sans-serif;
|
| 82 |
font-size: 24px;
|
|
|
|
| 85 |
.gradio-row {
|
| 86 |
margin-top: 10px;
|
| 87 |
}
|
| 88 |
+
|
| 89 |
/* Centrer la colonne et ajouter un style à la zone de texte */
|
| 90 |
.gr-column {
|
| 91 |
width: 50%;
|
|
|
|
| 96 |
background-color: #f9f9f9;
|
| 97 |
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
| 98 |
}
|
| 99 |
+
|
| 100 |
/* Appliquer un style pour le texte d'entrée */
|
| 101 |
.gr-textbox {
|
| 102 |
font-size: 16px;
|
| 103 |
padding: 10px;
|
| 104 |
}
|
| 105 |
+
|
| 106 |
/* Appliquer un style pour la sortie de traduction */
|
| 107 |
.gr-textbox[placeholder='Le texte traduit s\'affichera ici...'] {
|
| 108 |
font-size: 16px;
|