Spaces:
Sleeping
Sleeping
File size: 767 Bytes
3f02912 358f1b2 3f02912 358f1b2 3f02912 e3af09f 3f02912 358f1b2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | import gradio as gr
from transformers import pipeline
# Intenta cargar el modelo
try:
neutralizer = pipeline('text2text-generation', model='seayala/mbart-neutralization')
except Exception as e:
print(f"Error al cargar el modelo: {e}")
neutralizer = None
def neutralize(text):
if neutralizer is None:
return "El modelo no se ha podido cargar."
result = neutralizer(text)
return result[0]['generated_text']
iface = gr.Interface(
fn=neutralize,
inputs=gr.Textbox(lines=2, placeholder="Introduce una frase misógina..."),
outputs="text",
title="Neutralizador de frases misóginas",
description="Este espacio utiliza el modelo seayala/mbart-neutralization para neutralizar frases misóginas.",
)
iface.launch()
|