prol99 commited on
Commit
e4c5cb1
verified
1 Parent(s): e157c00

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Cargar el modelo
5
+ model = pipeline("translation", model="projecte-aina/aina-translator-es-ast")
6
+
7
+ # Funci贸n para traducir
8
+ def translate(text):
9
+ return model(text)[0]['translation_text']
10
+
11
+ # Crear la interfaz de Gradio
12
+ interface = gr.Interface(
13
+ fn=translate,
14
+ inputs=gr.Textbox(label="Texto en espa帽ol"),
15
+ outputs=gr.Textbox(label="Traducci贸n al asturiano")
16
+ )
17
+
18
+ # Lanzar la interfaz
19
+ interface.launch()