Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,8 @@ pipe = TextClassificationPipeline(model=model, tokenizer=tokenizer, add_special_
|
|
| 10 |
def classify_message(ues_detallada, medio_de_comunicacion, asunto_o_copy):
|
| 11 |
combined = f"{ues_detallada.upper()} por {medio_de_comunicacion}. {asunto_o_copy}"
|
| 12 |
prediction = pipe(combined)
|
| 13 |
-
|
|
|
|
| 14 |
|
| 15 |
# Crear la interfaz de Gradio
|
| 16 |
iface = gr.Interface(
|
|
|
|
| 10 |
def classify_message(ues_detallada, medio_de_comunicacion, asunto_o_copy):
|
| 11 |
combined = f"{ues_detallada.upper()} por {medio_de_comunicacion}. {asunto_o_copy}"
|
| 12 |
prediction = pipe(combined)
|
| 13 |
+
randoma = random.uniform(0, 0.4)
|
| 14 |
+
return {"Comercial" if prediction[0]['label'] == 'LABEL_0' else "Informativo": float(prediction[0]['score']-randoma), "Informativo" if prediction[0]['label'] == 'LABEL_0' else "Comercial": float(1-prediction[0]['score']+randoma)}
|
| 15 |
|
| 16 |
# Crear la interfaz de Gradio
|
| 17 |
iface = gr.Interface(
|