Spaces:
Running
Running
add style
Browse files- interfaces/cap_minor.py +8 -1
interfaces/cap_minor.py
CHANGED
@@ -89,12 +89,19 @@ def predict(text, model_id, tokenizer_id):
|
|
89 |
text_color = "black"
|
90 |
bar_width = int(prob * 100)
|
91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
html += f"""
|
93 |
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px;">
|
94 |
<span style="color: {text_color};">{label}</span>
|
95 |
<span style="color: {text_color};">{int(prob * 100)}%</span>
|
96 |
</div>
|
97 |
-
<div style="height: 4px; background
|
98 |
"""
|
99 |
first = False
|
100 |
|
|
|
89 |
text_color = "black"
|
90 |
bar_width = int(prob * 100)
|
91 |
|
92 |
+
if first:
|
93 |
+
html += f"""
|
94 |
+
<div style="display: flex; bold; font-size: 30px; justify-content: space-between; align-items: center; margin-bottom: 4px;">
|
95 |
+
<span style="color: {text_color};">{label}</span>
|
96 |
+
</div>
|
97 |
+
"""
|
98 |
+
|
99 |
html += f"""
|
100 |
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px;">
|
101 |
<span style="color: {text_color};">{label}</span>
|
102 |
<span style="color: {text_color};">{int(prob * 100)}%</span>
|
103 |
</div>
|
104 |
+
<div style="height: 4px; background: linear-gradient(to right, red, green); width: {bar_width}%; margin-bottom: 8px;"></div>
|
105 |
"""
|
106 |
first = False
|
107 |
|