JeanCGuerrero commited on
Commit
814bf70
verified
1 Parent(s): 95ceab0

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +22 -0
  2. requirements.txt +3 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ # Nombre del repositorio del modelo que subiste a Hugging Face
5
+ repo_id = "jeancguerrero/mbart-neutralization" # <- cambia por el tuyo si es distinto
6
+
7
+ # Cargamos el modelo con pipeline
8
+ neutralizer = pipeline("text2text-generation", model=repo_id)
9
+
10
+ # Funci贸n de predicci贸n
11
+ def predict(text):
12
+ output = neutralizer(text)
13
+ return output[0]["generated_text"]
14
+
15
+ # Interfaz Gradio
16
+ gr.Interface(
17
+ fn=predict,
18
+ inputs=gr.Textbox(lines=2, placeholder="Escribe una frase con lenguaje exclusivo..."),
19
+ outputs=gr.Textbox(label="Frase neutralizada"),
20
+ title="Neutralizador de lenguaje inclusivo",
21
+ description="Convierte frases con lenguaje exclusivo a inclusivo usando un modelo entrenado con MBART."
22
+ ).launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ transformers
2
+ torch
3
+ gradio