Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Fix: Wheel
Browse files
app.py
CHANGED
|
@@ -134,7 +134,7 @@ def predict(review: str):
|
|
| 134 |
#html_out = f"<b>{html.escape(review)}</b>"
|
| 135 |
|
| 136 |
html_out = '''
|
| 137 |
-
<svg viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
| 138 |
|
| 139 |
<defs>
|
| 140 |
<path id="textPathU-68cfc5fd8ae1e" d="M 250, 250 m 0, 220 a -220,-220 0 1,1 0,-440 a -220,-220 0 1,1 0,440" style="stroke: red; fill: none;" />
|
|
@@ -204,7 +204,7 @@ def predict(review: str):
|
|
| 204 |
</textPath>
|
| 205 |
</text>
|
| 206 |
|
| 207 |
-
<polyline class="graph" points
|
| 208 |
|
| 209 |
<circle class="point" style="stroke: black; fill: white;" cx="250" cy="250" r="3.5" />
|
| 210 |
<circle class="point" style="stroke: black; fill: white;" cx="250" cy="250" r="3.5" />
|
|
@@ -217,43 +217,68 @@ def predict(review: str):
|
|
| 217 |
|
| 218 |
</svg>
|
| 219 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
<script>
|
| 221 |
-
|
| 222 |
|
| 223 |
-
|
| 224 |
-
|
| 225 |
|
| 226 |
-
|
| 227 |
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
|
| 232 |
-
|
| 233 |
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
|
| 239 |
-
|
| 240 |
|
| 241 |
-
|
| 242 |
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
|
| 256 |
-
|
| 257 |
</script>
|
| 258 |
'''
|
| 259 |
|
|
|
|
| 134 |
#html_out = f"<b>{html.escape(review)}</b>"
|
| 135 |
|
| 136 |
html_out = '''
|
| 137 |
+
<svg id="wheel" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
| 138 |
|
| 139 |
<defs>
|
| 140 |
<path id="textPathU-68cfc5fd8ae1e" d="M 250, 250 m 0, 220 a -220,-220 0 1,1 0,-440 a -220,-220 0 1,1 0,440" style="stroke: red; fill: none;" />
|
|
|
|
| 204 |
</textPath>
|
| 205 |
</text>
|
| 206 |
|
| 207 |
+
<polyline class="graph" points></polyline>
|
| 208 |
|
| 209 |
<circle class="point" style="stroke: black; fill: white;" cx="250" cy="250" r="3.5" />
|
| 210 |
<circle class="point" style="stroke: black; fill: white;" cx="250" cy="250" r="3.5" />
|
|
|
|
| 217 |
|
| 218 |
</svg>
|
| 219 |
|
| 220 |
+
<style>
|
| 221 |
+
svg#wheel > .circle,
|
| 222 |
+
svg#wheel > .line {
|
| 223 |
+
stroke: rgb(180, 180, 180) !important;
|
| 224 |
+
}
|
| 225 |
+
svg#wheel > .point {
|
| 226 |
+
stroke: rgb(120, 120, 120) !important;
|
| 227 |
+
fill: rgb(255, 255, 255) !important;
|
| 228 |
+
}
|
| 229 |
+
svg#wheel > .graph {
|
| 230 |
+
fill: rgb(250, 208, 72);
|
| 231 |
+
fill-opacity: 0.9;
|
| 232 |
+
}
|
| 233 |
+
svg#wheel > text {
|
| 234 |
+
font-family: 'Roboto Condensed', sans-serif;
|
| 235 |
+
font-style: normal;
|
| 236 |
+
font-weight: 400;
|
| 237 |
+
font-size: 18px;
|
| 238 |
+
// text-transform: uppercase;
|
| 239 |
+
&.scale {
|
| 240 |
+
fill: rgb(180, 180, 180);
|
| 241 |
+
}
|
| 242 |
+
}
|
| 243 |
+
</style>
|
| 244 |
+
|
| 245 |
<script>
|
| 246 |
+
const setPoints = function (vals) {
|
| 247 |
|
| 248 |
+
const elemsPoint = document.querySelectorAll('.point');
|
| 249 |
+
const elemGraph = document.querySelector('.graph');
|
| 250 |
|
| 251 |
+
const points = [];
|
| 252 |
|
| 253 |
+
elemsPoint.forEach(function(elemPoint, i) {
|
| 254 |
+
// steps offset convert to bogenmass
|
| 255 |
+
const angle = (360 / config.segments * i + config.offsetAngle - 90) * (Math.PI * 2 / 360);
|
| 256 |
|
| 257 |
+
const val = vals[i];
|
| 258 |
|
| 259 |
+
const c = {
|
| 260 |
+
x: Math.cos(angle) * (val * config.inputRatio + config.innerRadius) + config.offsetCenter,
|
| 261 |
+
y: Math.sin(angle) * (val * config.inputRatio + config.innerRadius) + config.offsetCenter
|
| 262 |
+
}
|
| 263 |
|
| 264 |
+
points.push(`${c.x},${c.y}`);
|
| 265 |
|
| 266 |
+
elemGraph.setAttribute('points', points.join(' '));
|
| 267 |
|
| 268 |
+
elemPoint.setAttribute('cx', `${c.x}`);
|
| 269 |
+
elemPoint.setAttribute('cy', `${c.y}`);
|
| 270 |
+
});
|
| 271 |
+
}
|
| 272 |
|
| 273 |
+
const config = {
|
| 274 |
+
segments: 8,
|
| 275 |
+
offsetAngle: 0,
|
| 276 |
+
innerRadius: 40,
|
| 277 |
+
offsetCenter: 250,
|
| 278 |
+
inputRatio: 16
|
| 279 |
+
};
|
| 280 |
|
| 281 |
+
setPoints([0, 1, 1.5, 0, 2, 0, 3.4, 2])
|
| 282 |
</script>
|
| 283 |
'''
|
| 284 |
|