Spaces:
Sleeping
Sleeping
UI update
Browse files
app.py
CHANGED
@@ -2,10 +2,27 @@ import gradio as gr
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
def translator(sentence):
|
5 |
-
model_checkpoint = "/
|
6 |
translator = pipeline("translation", model=model_checkpoint)
|
7 |
return translator(sentence)[0]['translation_text']
|
8 |
|
9 |
-
|
10 |
-
demo.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
|
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
def translator(sentence):
|
5 |
+
model_checkpoint = "AirrStorm/Finetuned-OpusMT-EN2FR"
|
6 |
translator = pipeline("translation", model=model_checkpoint)
|
7 |
return translator(sentence)[0]['translation_text']
|
8 |
|
9 |
+
# Create a cleaner UI with input and output labels and additional styling
|
10 |
+
demo = gr.Interface(
|
11 |
+
fn=translator,
|
12 |
+
inputs=gr.Textbox(
|
13 |
+
lines=3,
|
14 |
+
placeholder="Enter text in English...",
|
15 |
+
label="Input (English)"
|
16 |
+
),
|
17 |
+
outputs=gr.Textbox(
|
18 |
+
lines=3,
|
19 |
+
placeholder="Translation will appear here...",
|
20 |
+
label="Output (French)"
|
21 |
+
),
|
22 |
+
title="English to French Translator",
|
23 |
+
description="This tool translates text from English to French. Especially fine-tuned for programming-related terms.",
|
24 |
+
theme="compact", # Optional: use a more compact layout
|
25 |
+
live=False # Live updates are not necessary for translation
|
26 |
+
)
|
27 |
|
28 |
+
demo.launch()
|