Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -58,8 +58,7 @@ def plot_anomalies(df_test_value, data, anomalies):
|
|
58 |
ax.set_ylabel("Value")
|
59 |
ax.set_title("Anomalous Data Points")
|
60 |
return fig
|
61 |
-
|
62 |
-
|
63 |
def master(file):
|
64 |
# read file
|
65 |
data = pd.read_csv(file, parse_dates=True, index_col="timestamp")
|
@@ -70,18 +69,9 @@ def master(file):
|
|
70 |
anomalies = get_anomalies(df_test_value)
|
71 |
#plot anomalous data points
|
72 |
plot2 = plot_anomalies(df_test_value, data, anomalies)
|
73 |
-
|
74 |
-
outlier_indices = np.where(anomalies)[0]
|
75 |
-
# Create dataframe with outlier timestamps and values
|
76 |
-
outliers_df = data.iloc[outlier_indices]
|
77 |
-
return plot2, outliers_df
|
78 |
|
79 |
-
|
80 |
-
inputs = gr.inputs.File(label="Upload CSV File")
|
81 |
-
outputs = [
|
82 |
-
gr.outputs.Image(label="Anomalous Data Points"),
|
83 |
-
gr.outputs.Dataframe(label="Detected Outliers")
|
84 |
-
]
|
85 |
|
86 |
iface = gr.Interface(
|
87 |
fn=master,
|
|
|
58 |
ax.set_ylabel("Value")
|
59 |
ax.set_title("Anomalous Data Points")
|
60 |
return fig
|
61 |
+
|
|
|
62 |
def master(file):
|
63 |
# read file
|
64 |
data = pd.read_csv(file, parse_dates=True, index_col="timestamp")
|
|
|
69 |
anomalies = get_anomalies(df_test_value)
|
70 |
#plot anomalous data points
|
71 |
plot2 = plot_anomalies(df_test_value, data, anomalies)
|
72 |
+
return plot2
|
|
|
|
|
|
|
|
|
73 |
|
74 |
+
outputs = gr.outputs.Image()
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
iface = gr.Interface(
|
77 |
fn=master,
|