AirrStorm commited on
Commit
89a8e5f
·
1 Parent(s): 3c5e0cf
Files changed (1) hide show
  1. app.py +20 -3
app.py CHANGED
@@ -2,10 +2,27 @@ import gradio as gr
2
  from transformers import pipeline
3
 
4
  def translator(sentence):
5
- model_checkpoint = "/home/airrstorm/Documents/Python/Hugging-Face/Models/Finetuned-OpusMT-EN2FR"
6
  translator = pipeline("translation", model=model_checkpoint)
7
  return translator(sentence)[0]['translation_text']
8
 
9
- demo = gr.Interface(fn=translator, inputs="text", outputs="text", title="Translation", description="Translate text from English to French.")
10
- demo.launch(share=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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()