Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -59,14 +59,21 @@ def plot_anomalies(df_test_value, data, anomalies):
|
|
| 59 |
ax.set_title("Anomalous Data Points")
|
| 60 |
return fig
|
| 61 |
|
| 62 |
-
def format_output(plot,
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
def master(file):
|
| 72 |
# read file
|
|
|
|
| 59 |
ax.set_title("Anomalous Data Points")
|
| 60 |
return fig
|
| 61 |
|
| 62 |
+
def format_output(plot, indices):
|
| 63 |
+
# Create a new figure and axis for the combined output
|
| 64 |
+
fig_combined, (ax_plot, ax_text) = plt.subplots(nrows=2, figsize=(12, 8), gridspec_kw={'height_ratios': [6, 1]})
|
| 65 |
+
|
| 66 |
+
# Add the plot to the top axis
|
| 67 |
+
fig, ax = plot
|
| 68 |
+
ax_plot.imshow(fig.canvas.renderer.buffer_rgba())
|
| 69 |
+
ax_plot.axis('off')
|
| 70 |
+
|
| 71 |
+
# Add the text to the bottom axis
|
| 72 |
+
ax_text.text(0.5, 0, f"Anomalous Data Indices: {', '.join(indices)}", fontsize=12, ha='center')
|
| 73 |
+
ax_text.axis('off')
|
| 74 |
+
|
| 75 |
+
return fig_combined, None
|
| 76 |
+
|
| 77 |
|
| 78 |
def master(file):
|
| 79 |
# read file
|