Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,7 +26,6 @@ def classify_text(text):
|
|
| 26 |
score, pred = torch.max(probs, dim=-1)
|
| 27 |
|
| 28 |
label = model.config.id2label[pred.item()]
|
| 29 |
-
confidence = round(score.item() * 100, 1)
|
| 30 |
|
| 31 |
# Format output with icons and styling
|
| 32 |
icon = "👤" if label.lower() == "human" else "🤖"
|
|
@@ -35,10 +34,6 @@ def classify_text(text):
|
|
| 35 |
### {icon} Classification Result
|
| 36 |
|
| 37 |
**Prediction:** {label}-Written Text
|
| 38 |
-
|
| 39 |
-
**Confidence:** {confidence}%
|
| 40 |
-
|
| 41 |
-
{'🟦' * int(confidence // 10)} {confidence}%
|
| 42 |
"""
|
| 43 |
|
| 44 |
return result
|
|
@@ -100,13 +95,6 @@ button:hover {
|
|
| 100 |
}
|
| 101 |
"""
|
| 102 |
|
| 103 |
-
# Example texts
|
| 104 |
-
examples = [
|
| 105 |
-
["The sun set over the horizon, painting the sky in brilliant shades of orange and pink. I sat there, mesmerized by nature's beauty."],
|
| 106 |
-
["According to recent data analysis, the implementation of artificial intelligence systems has increased operational productivity by approximately 40 percent across various industries."],
|
| 107 |
-
["Can't believe how amazing that concert was last night! The energy in the crowd was absolutely electric 🎸✨"],
|
| 108 |
-
]
|
| 109 |
-
|
| 110 |
# Create interface with modern theme
|
| 111 |
iface = gr.Interface(
|
| 112 |
fn=classify_text,
|
|
|
|
| 26 |
score, pred = torch.max(probs, dim=-1)
|
| 27 |
|
| 28 |
label = model.config.id2label[pred.item()]
|
|
|
|
| 29 |
|
| 30 |
# Format output with icons and styling
|
| 31 |
icon = "👤" if label.lower() == "human" else "🤖"
|
|
|
|
| 34 |
### {icon} Classification Result
|
| 35 |
|
| 36 |
**Prediction:** {label}-Written Text
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
"""
|
| 38 |
|
| 39 |
return result
|
|
|
|
| 95 |
}
|
| 96 |
"""
|
| 97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
# Create interface with modern theme
|
| 99 |
iface = gr.Interface(
|
| 100 |
fn=classify_text,
|