Use HTML to center message's text
Browse files
app.py
CHANGED
|
@@ -36,14 +36,16 @@ def get_clusters_plot(n_blobs, quantile, cluster_std):
|
|
| 36 |
|
| 37 |
if len(centers) != n_clusters_:
|
| 38 |
message = (
|
| 39 |
-
|
|
|
|
| 40 |
+ f" differs from the true number of clusters ({n_blobs})."
|
| 41 |
-
+ " Try changing the `Quantile` parameter
|
| 42 |
)
|
| 43 |
else:
|
| 44 |
message = (
|
| 45 |
-
|
| 46 |
-
+ f"
|
|
|
|
| 47 |
)
|
| 48 |
return fig, message
|
| 49 |
|
|
@@ -65,12 +67,12 @@ demo = gr.Interface(
|
|
| 65 |
gr.Slider(
|
| 66 |
minimum=0.1,
|
| 67 |
maximum=1,
|
| 68 |
-
label="
|
| 69 |
step=0.1,
|
| 70 |
value=0.6,
|
| 71 |
),
|
| 72 |
],
|
| 73 |
-
[gr.Plot(), gr.
|
| 74 |
allow_flagging="never",
|
| 75 |
)
|
| 76 |
|
|
|
|
| 36 |
|
| 37 |
if len(centers) != n_clusters_:
|
| 38 |
message = (
|
| 39 |
+
'<p style="text-align: center;">'
|
| 40 |
+
+ f"The number of estimated clusters ({n_clusters_})"
|
| 41 |
+ f" differs from the true number of clusters ({n_blobs})."
|
| 42 |
+
+ " Try changing the `Quantile` parameter.</p>"
|
| 43 |
)
|
| 44 |
else:
|
| 45 |
message = (
|
| 46 |
+
'<p style="text-align: center;">'
|
| 47 |
+
+ f"The number of estimated clusters ({n_clusters_})"
|
| 48 |
+
+ f" matches the true number of clusters ({n_blobs})!</p>"
|
| 49 |
)
|
| 50 |
return fig, message
|
| 51 |
|
|
|
|
| 67 |
gr.Slider(
|
| 68 |
minimum=0.1,
|
| 69 |
maximum=1,
|
| 70 |
+
label="Clusters standard deviation",
|
| 71 |
step=0.1,
|
| 72 |
value=0.6,
|
| 73 |
),
|
| 74 |
],
|
| 75 |
+
[gr.Plot(label="Clusters' Plot"), gr.HTML()],
|
| 76 |
allow_flagging="never",
|
| 77 |
)
|
| 78 |
|