Upload 2 files
Browse files
app.py
CHANGED
|
@@ -1,19 +1,8 @@
|
|
| 1 |
-
import os
|
| 2 |
-
|
| 3 |
-
# Eliminar posibles instalaciones corruptas
|
| 4 |
-
os.system("pip uninstall -y transformers gradio torch torchvision torchaudio sentencepiece")
|
| 5 |
-
|
| 6 |
-
# Instalar nuevamente sin errores
|
| 7 |
-
os.system("pip install transformers gradio torch torchvision torchaudio sentencepiece")
|
| 8 |
-
|
| 9 |
-
|
| 10 |
import gradio as gr
|
| 11 |
from transformers import pipeline
|
| 12 |
|
| 13 |
# Cargar el modelo
|
| 14 |
-
print("Cargando el modelo...")
|
| 15 |
model = pipeline("translation", model="projecte-aina/aina-translator-es-ast")
|
| 16 |
-
print("Modelo cargado con 茅xito.")
|
| 17 |
|
| 18 |
# Funci贸n para traducir
|
| 19 |
def translate(text):
|
|
@@ -26,5 +15,5 @@ interface = gr.Interface(
|
|
| 26 |
outputs=gr.Textbox(label="Traducci贸n al asturiano")
|
| 27 |
)
|
| 28 |
|
| 29 |
-
|
| 30 |
-
interface.launch(debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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):
|
|
|
|
| 15 |
outputs=gr.Textbox(label="Traducci贸n al asturiano")
|
| 16 |
)
|
| 17 |
|
| 18 |
+
# Lanzar la interfaz
|
| 19 |
+
interface.launch(debug=True, share=True)
|