joinfv commited on
Commit
47b898d
·
verified ·
1 Parent(s): 60133c2

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #tradutor nq usando pipelines
2
+ #Autor..: joinfv
3
+ #Data...:20/11/2024
4
+ import gradio as gr
5
+
6
+ from transformers import pipeline
7
+
8
+ #load model
9
+ pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-tc-big-en-pt")
10
+
11
+ def predict(text):
12
+ return pipe(text)[0]["translation_text"]
13
+
14
+ title = "Tradutor inglês para Brasileires"
15
+
16
+ iface = gr.Interface(
17
+ fn=predict,
18
+ inputs=[gr.Textbox(label="text", lines=3)],
19
+ outputs='text',
20
+ title=title,
21
+ )
22
+
23
+ iface.launch()