Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
# Definir la funci贸n de inferencia
|
4 |
+
def classify_message(ues_detallada, medio_de_comunicacion, asunto_o_copy):
|
5 |
+
combined = f"{ues_detallada} por {medio_de_comunicacion}. {asunto_o_copy}"
|
6 |
+
prediction = pipe(combined, model="models/hedtorresca/Multilingual-MiniLM-L12-H384-fine-tunning2")
|
7 |
+
return "Comercial" if prediction[0]['label'] == 'LABEL_0' else "Informativo"
|
8 |
+
|
9 |
+
# Crear la interfaz de Gradio
|
10 |
+
iface = gr.Interface(
|
11 |
+
fn=classify_message,
|
12 |
+
inputs=[
|
13 |
+
gr.inputs.Dropdown(["Unidad de Negocio 1", "Unidad de Negocio 2", "Unidad de Negocio 3"], label="Unidad de Negocio"),
|
14 |
+
gr.inputs.Radio(["Correo", "SMS"], label="Canal de Comunicaci贸n"),
|
15 |
+
gr.inputs.Textbox(lines=2, placeholder="Escribe el asunto o copy del mensaje aqu铆...", label="Asunto o Copy")
|
16 |
+
],
|
17 |
+
outputs="text",
|
18 |
+
title="Clasificador de Campa帽as",
|
19 |
+
description="Selecciona una unidad de negocio, un canal de comunicaci贸n y escribe un mensaje para clasificar si es comercial o informativo."
|
20 |
+
)
|
21 |
+
|
22 |
+
# Lanzar la interfaz
|
23 |
+
iface.launch()
|