| import gradio as gr | |
| from transformers import pipeline | |
| # Cargar el modelo | |
| model = pipeline("translation", model="projecte-aina/aina-translator-es-ast") | |
| # Funci贸n para traducir | |
| def translate(text): | |
| return model(text)[0]['translation_text'] | |
| # Crear la interfaz de Gradio | |
| interface = gr.Interface( | |
| fn=translate, | |
| inputs=gr.Textbox(label="Texto en espa帽ol"), | |
| outputs=gr.Textbox(label="Traducci贸n al asturiano") | |
| ) | |
| # Lanzar la interfaz | |
| interface.launch(debug=True, share=True) | |