Spaces:
Runtime error
Runtime error
feat: update visualization
Browse files
app.py
CHANGED
|
@@ -26,10 +26,10 @@ model = AutoModelForSequenceClassification.from_pretrained(
|
|
| 26 |
)
|
| 27 |
model.config.return_all_scores = True
|
| 28 |
LABEL_MAPPING = {
|
| 29 |
-
'pos': 'π€ Positive
|
| 30 |
-
'neu': 'π Neutral
|
| 31 |
-
'neg': 'π‘ Negative
|
| 32 |
-
'q': 'π€ Quesiton
|
| 33 |
}
|
| 34 |
CSS_PROGRESS_BAR_MAPPING = {
|
| 35 |
'pos':'w3-green',
|
|
@@ -53,7 +53,7 @@ def render_html(items: List[Dict]):
|
|
| 53 |
|
| 54 |
progress_bar_class_text = CSS_PROGRESS_BAR_MAPPING[label_id]
|
| 55 |
|
| 56 |
-
html_text += f'<span>{label.replace(" ", " ")}
|
| 57 |
f'<div class="w3-light-grey w3-round"><div class="{progress_bar_class_text} w3-round" style="height:19px;width:{round(score*100,2)}%"></div></div><div style="height:8px;"></div>'
|
| 58 |
|
| 59 |
return '<div class="w3-container">' + html_text + '</div>'
|
|
|
|
| 26 |
)
|
| 27 |
model.config.return_all_scores = True
|
| 28 |
LABEL_MAPPING = {
|
| 29 |
+
'pos': 'π€ Positive',
|
| 30 |
+
'neu': 'π Neutral',
|
| 31 |
+
'neg': 'π‘ Negative',
|
| 32 |
+
'q': 'π€ Quesiton',
|
| 33 |
}
|
| 34 |
CSS_PROGRESS_BAR_MAPPING = {
|
| 35 |
'pos':'w3-green',
|
|
|
|
| 53 |
|
| 54 |
progress_bar_class_text = CSS_PROGRESS_BAR_MAPPING[label_id]
|
| 55 |
|
| 56 |
+
html_text += f'<span>{label.replace(" ", " ")}: {(score*100):8.2f}%<span>' + \
|
| 57 |
f'<div class="w3-light-grey w3-round"><div class="{progress_bar_class_text} w3-round" style="height:19px;width:{round(score*100,2)}%"></div></div><div style="height:8px;"></div>'
|
| 58 |
|
| 59 |
return '<div class="w3-container">' + html_text + '</div>'
|