Spaces:
Sleeping
Sleeping
| 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() | |