Update app.py
Browse files
app.py
CHANGED
|
@@ -203,7 +203,6 @@ def run_model_on_image(img: Image.Image) -> np.ndarray:
|
|
| 203 |
|
| 204 |
def make_plot_from_output(model_output: Union[Dict[str, float], List[Tuple[str, Dict[str, float]]]]) -> str:
|
| 205 |
"""Return an embeddable *static* SVG radar chart as an HTML string.
|
| 206 |
-
|
| 207 |
Accepts either a single dict `{axis -> value in [0,1]}` or a list of up to
|
| 208 |
four series: `[(name, {axis->value}), ...]`. The chart is responsive and
|
| 209 |
includes a legend and hoverable point labels.
|
|
@@ -352,7 +351,7 @@ def make_plot_from_output(model_output: Union[Dict[str, float], List[Tuple[str,
|
|
| 352 |
x, y = polar_to_cart(radius * v, angle(i))
|
| 353 |
pts.append(f"{x},{y}")
|
| 354 |
polygons.append(
|
| 355 |
-
f'<polygon points="{" ".join(pts)}" fill="{color}22" stroke="{color}" stroke-width="
|
| 356 |
)
|
| 357 |
# Dots with hover labels per series
|
| 358 |
for i, v in enumerate(vals):
|
|
@@ -365,7 +364,7 @@ def make_plot_from_output(model_output: Union[Dict[str, float], List[Tuple[str,
|
|
| 365 |
dots.append(
|
| 366 |
(
|
| 367 |
'<g class="pt">'
|
| 368 |
-
f'<circle cx="{x}" cy="{y}" r="
|
| 369 |
f'<text x="{tx}" y="{ty}" font-size="12" stroke="#fff" stroke-width="3" paint-order="stroke">{label}</text>'
|
| 370 |
f'<text x="{tx}" y="{ty}" font-size="12" fill="#111">{label}</text>'
|
| 371 |
'</g>'
|
|
|
|
| 203 |
|
| 204 |
def make_plot_from_output(model_output: Union[Dict[str, float], List[Tuple[str, Dict[str, float]]]]) -> str:
|
| 205 |
"""Return an embeddable *static* SVG radar chart as an HTML string.
|
|
|
|
| 206 |
Accepts either a single dict `{axis -> value in [0,1]}` or a list of up to
|
| 207 |
four series: `[(name, {axis->value}), ...]`. The chart is responsive and
|
| 208 |
includes a legend and hoverable point labels.
|
|
|
|
| 351 |
x, y = polar_to_cart(radius * v, angle(i))
|
| 352 |
pts.append(f"{x},{y}")
|
| 353 |
polygons.append(
|
| 354 |
+
f'<polygon points="{" ".join(pts)}" fill="{color}22" stroke="{color}" stroke-width="1" />'
|
| 355 |
)
|
| 356 |
# Dots with hover labels per series
|
| 357 |
for i, v in enumerate(vals):
|
|
|
|
| 364 |
dots.append(
|
| 365 |
(
|
| 366 |
'<g class="pt">'
|
| 367 |
+
f'<circle cx="{x}" cy="{y}" r="3" fill="{color}" stroke="#fff" stroke-width="1.5" />'
|
| 368 |
f'<text x="{tx}" y="{ty}" font-size="12" stroke="#fff" stroke-width="3" paint-order="stroke">{label}</text>'
|
| 369 |
f'<text x="{tx}" y="{ty}" font-size="12" fill="#111">{label}</text>'
|
| 370 |
'</g>'
|