Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,7 +8,7 @@ tokenizer = AutoTokenizer.from_pretrained(model_id, return_dict=True )
|
|
| 8 |
pipe = TextClassificationPipeline(model=model, tokenizer=tokenizer, add_special_tokens=True, max_length= 512, truncation= True)
|
| 9 |
# Definir la funci贸n de inferencia
|
| 10 |
def classify_message(ues_detallada, medio_de_comunicacion, asunto_o_copy):
|
| 11 |
-
combined = f"
|
| 12 |
prediction = pipe(combined)
|
| 13 |
return "Comercial" if prediction[0]['label'] == 'LABEL_0' else "Informativo"
|
| 14 |
|
|
@@ -16,7 +16,7 @@ def classify_message(ues_detallada, medio_de_comunicacion, asunto_o_copy):
|
|
| 16 |
iface = gr.Interface(
|
| 17 |
fn=classify_message,
|
| 18 |
inputs=[
|
| 19 |
-
gr.Textbox(lines=2, placeholder="Escribe la UES aqu铆.", label="UES")
|
| 20 |
gr.Radio(["EMAIL", "SMS"], label="Canal de Comunicaci贸n"),
|
| 21 |
gr.Textbox(lines=2, placeholder="Escribe el asunto o copy del mensaje aqu铆.", label="Asunto o Copy")
|
| 22 |
],
|
|
|
|
| 8 |
pipe = TextClassificationPipeline(model=model, tokenizer=tokenizer, add_special_tokens=True, max_length= 512, truncation= True)
|
| 9 |
# Definir la funci贸n de inferencia
|
| 10 |
def classify_message(ues_detallada, medio_de_comunicacion, asunto_o_copy):
|
| 11 |
+
combined = f"{ues_detallada} por {medio_de_comunicacion}. {asunto_o_copy}"
|
| 12 |
prediction = pipe(combined)
|
| 13 |
return "Comercial" if prediction[0]['label'] == 'LABEL_0' else "Informativo"
|
| 14 |
|
|
|
|
| 16 |
iface = gr.Interface(
|
| 17 |
fn=classify_message,
|
| 18 |
inputs=[
|
| 19 |
+
gr.Textbox(lines=2, placeholder="Escribe la UES aqu铆.", label="UES"),
|
| 20 |
gr.Radio(["EMAIL", "SMS"], label="Canal de Comunicaci贸n"),
|
| 21 |
gr.Textbox(lines=2, placeholder="Escribe el asunto o copy del mensaje aqu铆.", label="Asunto o Copy")
|
| 22 |
],
|