Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,7 +11,7 @@ import matplotlib as mpl
|
|
| 11 |
|
| 12 |
import numpy as np
|
| 13 |
import streamlit as st
|
| 14 |
-
import plotly.
|
| 15 |
|
| 16 |
# For measuring the inference time.
|
| 17 |
import time
|
|
@@ -34,7 +34,12 @@ def main():
|
|
| 34 |
if st.button("Prediction"):
|
| 35 |
# plot pca cluster plot
|
| 36 |
plot = plot_model(kmeans, plot = 'cluster', save = True)
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
if __name__ == '__main__':
|
| 40 |
main()
|
|
|
|
| 11 |
|
| 12 |
import numpy as np
|
| 13 |
import streamlit as st
|
| 14 |
+
import plotly.graph_objs as go
|
| 15 |
|
| 16 |
# For measuring the inference time.
|
| 17 |
import time
|
|
|
|
| 34 |
if st.button("Prediction"):
|
| 35 |
# plot pca cluster plot
|
| 36 |
plot = plot_model(kmeans, plot = 'cluster', save = True)
|
| 37 |
+
|
| 38 |
+
# Convert the plot to a compatible format for Streamlit
|
| 39 |
+
compatible_plot = go.Figure(data=plot['data'], layout=plot['layout'])
|
| 40 |
+
|
| 41 |
+
# Display the plot in Streamlit
|
| 42 |
+
st.plotly_chart(compatible_plot)
|
| 43 |
|
| 44 |
if __name__ == '__main__':
|
| 45 |
main()
|