Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -53,11 +53,11 @@ def plot_anomalies(df_test_value, data, anomalies):
|
|
53 |
df_subset = data.iloc[anomalous_data_indices]
|
54 |
fig, ax = plt.subplots(figsize=(12, 6))
|
55 |
data.plot(legend=False, ax=ax)
|
56 |
-
df_subset.plot(legend=False, ax=ax, color="r")
|
57 |
ax.set_xlabel("Time")
|
58 |
ax.set_ylabel("Value")
|
59 |
ax.set_title("Anomalous Data Points")
|
60 |
-
return fig
|
61 |
|
62 |
def master(file):
|
63 |
# read file
|
@@ -77,10 +77,10 @@ def master(file):
|
|
77 |
anomalies = get_anomalies(df_test_value)
|
78 |
|
79 |
# plot anomalous data points
|
80 |
-
plot2 = plot_anomalies(df_test_value, data, anomalies)
|
81 |
|
82 |
# Update Gradio interface to show the resulting plot
|
83 |
-
return plot2
|
84 |
|
85 |
outputs = gr.outputs.Image()
|
86 |
|
@@ -93,4 +93,5 @@ iface = gr.Interface(
|
|
93 |
description="Anomaly detection of timeseries data."
|
94 |
)
|
95 |
|
96 |
-
iface.launch()
|
|
|
|
53 |
df_subset = data.iloc[anomalous_data_indices]
|
54 |
fig, ax = plt.subplots(figsize=(12, 6))
|
55 |
data.plot(legend=False, ax=ax)
|
56 |
+
df_subset.plot(legend=False, ax=ax, color="r", marker="o", linestyle="None")
|
57 |
ax.set_xlabel("Time")
|
58 |
ax.set_ylabel("Value")
|
59 |
ax.set_title("Anomalous Data Points")
|
60 |
+
return fig, anomalous_data_indices
|
61 |
|
62 |
def master(file):
|
63 |
# read file
|
|
|
77 |
anomalies = get_anomalies(df_test_value)
|
78 |
|
79 |
# plot anomalous data points
|
80 |
+
plot2, anomalous_indices = plot_anomalies(df_test_value, data, anomalies)
|
81 |
|
82 |
# Update Gradio interface to show the resulting plot
|
83 |
+
return plot2, anomalous_indices
|
84 |
|
85 |
outputs = gr.outputs.Image()
|
86 |
|
|
|
93 |
description="Anomaly detection of timeseries data."
|
94 |
)
|
95 |
|
96 |
+
iface.launch()
|
97 |
+
|