Spaces:
Runtime error
Runtime error
Added: switched matplotlib backend
Browse files
app.py
CHANGED
|
@@ -6,6 +6,7 @@ from sklearn.neighbors import kneighbors_graph
|
|
| 6 |
|
| 7 |
import gradio as gr
|
| 8 |
|
|
|
|
| 9 |
|
| 10 |
np.random.seed(42)
|
| 11 |
|
|
@@ -57,16 +58,5 @@ with gr.Blocks() as demo:
|
|
| 57 |
plot_btn.click(fn=agglomorative_cluster, inputs=[n_samples, n_neighbours, n_clusters, linkage, connectivity],
|
| 58 |
outputs=output, api_name="plotcluster")
|
| 59 |
|
| 60 |
-
# demo = gr.Interface(
|
| 61 |
-
# fn = agglomorative_cluster,
|
| 62 |
-
# inputs = [gr.Slider(0, 20_000, label="n_samples", info="the number of samples in the data.", step=1),
|
| 63 |
-
# gr.Slider(0, 30, label="n_neighbours", info="the number of neighbours in the data", step=1),
|
| 64 |
-
# gr.Dropdown([3, 30], label="n_clusters", info="the number of clusters in the data"),
|
| 65 |
-
# gr.Dropdown(['average', 'complete', 'ward', 'single'], label="linkage", info="the different types of aggolomorative clustering techniques"),
|
| 66 |
-
# gr.Checkbox(True, label="connectivity", info="whether to impose a connectivity into the graph")],
|
| 67 |
-
|
| 68 |
-
# outputs = [gr.Plot(label="Plot")]
|
| 69 |
-
# )
|
| 70 |
-
|
| 71 |
demo.launch()
|
| 72 |
|
|
|
|
| 6 |
|
| 7 |
import gradio as gr
|
| 8 |
|
| 9 |
+
plt.switch_backend("agg")
|
| 10 |
|
| 11 |
np.random.seed(42)
|
| 12 |
|
|
|
|
| 58 |
plot_btn.click(fn=agglomorative_cluster, inputs=[n_samples, n_neighbours, n_clusters, linkage, connectivity],
|
| 59 |
outputs=output, api_name="plotcluster")
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
demo.launch()
|
| 62 |
|