cuneytkaya commited on
Commit
8767a7a
1 Parent(s): 5979119

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+
5
+ translator = pipeline(
6
+ task="translation",
7
+ model="facebook/nllb-200-distilled-600M"
8
+ )
9
+
10
+
11
+ def translate_text(text):
12
+ translated = translator(text, src_lang="eng_Latn", tgt_lang="tur_Latn")
13
+ return translated[0]['translation_text']
14
+
15
+
16
+ demo = gr.Interface(
17
+ fn=translate_text,
18
+ inputs=gr.Textbox(label="Input Text (English)"),
19
+ outputs=gr.Textbox(label="Translated Text (Turkish)"),
20
+ title="English to Turkish Translator",
21
+ description="A demo that translates English text to Turkish using the NLLB-200 model."
22
+ )
23
+
24
+
25
+ demo.launch(share=True)