Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -30,15 +30,21 @@ def classify_confidence(text):
|
|
| 30 |
label = id2label[predicted_class]
|
| 31 |
prediction = label_map[label]
|
| 32 |
score = round(probs[0][predicted_class].item() * 100, 2)
|
|
|
|
| 33 |
|
| 34 |
-
|
| 35 |
|
| 36 |
iface = gr.Interface(
|
| 37 |
fn=classify_confidence,
|
| 38 |
inputs=gr.Textbox(lines=3, placeholder="Enter a statement..."),
|
| 39 |
outputs="text",
|
| 40 |
-
title="Confidence Classifier",
|
| 41 |
-
description="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
)
|
| 43 |
|
| 44 |
iface.launch()
|
|
|
|
| 30 |
label = id2label[predicted_class]
|
| 31 |
prediction = label_map[label]
|
| 32 |
score = round(probs[0][predicted_class].item() * 100, 2)
|
| 33 |
+
color = "green" if label == "LABEL_0" else "red"
|
| 34 |
|
| 35 |
+
return f"<b>Prediction:</b> <span style='color: {color}; font-weight: bold'>{label_text}</span> ({score}%)"
|
| 36 |
|
| 37 |
iface = gr.Interface(
|
| 38 |
fn=classify_confidence,
|
| 39 |
inputs=gr.Textbox(lines=3, placeholder="Enter a statement..."),
|
| 40 |
outputs="text",
|
| 41 |
+
title="🌟 Confidence Classifier",
|
| 42 |
+
description="""
|
| 43 |
+
Enter a statement, and this model will predict whether it shows confidence or not.
|
| 44 |
+
|
| 45 |
+
🔍 <i>Built using a fine-tuned DistilBERT model</i>
|
| 46 |
+
💡 <i>Great for journaling, speech prep, or daily reflections</i>
|
| 47 |
+
""",
|
| 48 |
)
|
| 49 |
|
| 50 |
iface.launch()
|