aopstudio commited on
Commit
ef5760a
·
1 Parent(s): e876a83
Files changed (2) hide show
  1. app.py +16 -0
  2. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ from transformers import pipeline
4
+
5
+ pipe = pipeline("translation", model="facebook/nllb-200-distilled-600M")
6
+
7
+ def predict(text):
8
+ return pipe(text,src_lang='eng_Latn',tgt_lang='zho_Hans')[0]['translation_text']
9
+
10
+ demo = gr.Interface(
11
+ fn=predict,
12
+ inputs='text',
13
+ outputs='text',
14
+ )
15
+
16
+ demo.launch(share=True)
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ transformers
2
+ torch