|
import gradio as gr |
|
from transformers import pipeline |
|
from presentation import main_title, examples |
|
|
|
model = 'hackathon-pln-es/Detect-Acoso-Twitter-Es' |
|
|
|
article = """ |
|
# UNL: Universidad Nacional de Loja |
|
### Miembros del equipo |
|
- Anderson Quizhpe |
|
- Luis Negrón |
|
- David Pacheco |
|
- Bryan Requenes |
|
- Paul Pasaca |
|
""" |
|
def classify(text): |
|
cls= pipeline("text-classification", model=model) |
|
return cls(text)[0]['label'] |
|
|
|
gr.Interface(fn=classify, inputs=[gr.inputs.Textbox( |
|
lines=5, |
|
label="Texto a analizar:", |
|
placeholder="Introduce o elige un ejemplo de twit:", |
|
optional=False, |
|
)], outputs=[gr.outputs.Textbox(label="Predicción"), |
|
], description=main_title, |
|
examples=examples, |
|
article=article, |
|
theme="peach", |
|
thumbnail="None", |
|
css="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css").launch(debug=True) |
|
|
|
|