Spaces:
Running
Running
Commit
·
0ff6193
1
Parent(s):
e991118
implemented detection
Browse files- wm_detector/core/utils.py +1 -0
- wm_detector/static/styles.css +16 -2
- wm_detector/templates/index.html +11 -6
wm_detector/core/utils.py
CHANGED
@@ -46,6 +46,7 @@ def get_token_details(
|
|
46 |
pvalue = float(pvalue)
|
47 |
|
48 |
display_info.append({
|
|
|
49 |
'token': token_detail['token_text'],
|
50 |
'color': color_from_score(score),
|
51 |
'score': score,
|
|
|
46 |
pvalue = float(pvalue)
|
47 |
|
48 |
display_info.append({
|
49 |
+
'is_scored': token_detail['is_scored'],
|
50 |
'token': token_detail['token_text'],
|
51 |
'color': color_from_score(score),
|
52 |
'score': score,
|
wm_detector/static/styles.css
CHANGED
@@ -59,13 +59,27 @@ h1 {
|
|
59 |
bottom: 125%;
|
60 |
left: 50%;
|
61 |
transform: translateX(-50%);
|
62 |
-
padding:
|
63 |
-
background-color: rgba(0, 0, 0, 0.
|
64 |
color: white;
|
65 |
border-radius: 4px;
|
66 |
font-size: 12px;
|
|
|
67 |
white-space: nowrap;
|
68 |
pointer-events: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
}
|
70 |
|
71 |
.token:hover .token-tooltip {
|
|
|
59 |
bottom: 125%;
|
60 |
left: 50%;
|
61 |
transform: translateX(-50%);
|
62 |
+
padding: 6px 10px;
|
63 |
+
background-color: rgba(0, 0, 0, 0.9);
|
64 |
color: white;
|
65 |
border-radius: 4px;
|
66 |
font-size: 12px;
|
67 |
+
line-height: 1.4;
|
68 |
white-space: nowrap;
|
69 |
pointer-events: none;
|
70 |
+
font-family: monospace;
|
71 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
|
72 |
+
}
|
73 |
+
|
74 |
+
.token-tooltip::after {
|
75 |
+
content: "";
|
76 |
+
position: absolute;
|
77 |
+
top: 100%;
|
78 |
+
left: 50%;
|
79 |
+
margin-left: -5px;
|
80 |
+
border-width: 5px;
|
81 |
+
border-style: solid;
|
82 |
+
border-color: rgba(0, 0, 0, 0.9) transparent transparent transparent;
|
83 |
}
|
84 |
|
85 |
.token:hover .token-tooltip {
|
wm_detector/templates/index.html
CHANGED
@@ -117,15 +117,20 @@
|
|
117 |
const data = await response.json();
|
118 |
|
119 |
// Update token display
|
120 |
-
tokenDisplay.innerHTML = data.tokens.map((token, i) =>
|
121 |
-
|
|
|
|
|
|
|
|
|
|
|
122 |
${token}
|
123 |
<div class="token-tooltip">
|
124 |
-
Score: ${
|
125 |
-
P-value: ${
|
126 |
</div>
|
127 |
-
</span
|
128 |
-
).join('');
|
129 |
|
130 |
// Update counts and stats
|
131 |
tokenCount.textContent = data.token_count;
|
|
|
117 |
const data = await response.json();
|
118 |
|
119 |
// Update token display
|
120 |
+
tokenDisplay.innerHTML = data.tokens.map((token, i) => {
|
121 |
+
const score = data.scores[i];
|
122 |
+
const pvalue = data.pvalues[i];
|
123 |
+
const scoreDisplay = (score !== null && !isNaN(score)) ? score.toFixed(3) : 'N/A';
|
124 |
+
const pvalueDisplay = (pvalue !== null && !isNaN(pvalue)) ? pvalue.toFixed(3) : 'N/A';
|
125 |
+
|
126 |
+
return `<span class="token" style="background-color: ${data.colors[i]}">
|
127 |
${token}
|
128 |
<div class="token-tooltip">
|
129 |
+
Score: ${scoreDisplay}<br>
|
130 |
+
P-value: ${pvalueDisplay}
|
131 |
</div>
|
132 |
+
</span>`;
|
133 |
+
}).join('');
|
134 |
|
135 |
// Update counts and stats
|
136 |
tokenCount.textContent = data.token_count;
|