DHEIVER commited on
Commit
7ead104
·
1 Parent(s): b555224

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -15,7 +15,7 @@ def create_sequences(values, time_steps=TIME_STEPS):
15
  output = []
16
  for i in range(len(values) - time_steps + 1):
17
  output.append(values[i : (i + time_steps)])
18
- return np.array(output)
19
 
20
 
21
  def normalize_data(data):
@@ -58,7 +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
  def master(file):
63
  # read file
64
  data = pd.read_csv(file, parse_dates=True, index_col="timestamp")
@@ -67,7 +67,7 @@ def master(file):
67
  plot1 = plot_test_data(df_test_value)
68
  # predict
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
 
@@ -77,7 +77,7 @@ iface = gr.Interface(
77
  fn=master,
78
  inputs=gr.inputs.File(label="CSV File"),
79
  outputs=outputs,
80
- examples=["art_daily_jumpsup.csv"],
81
  title="Timeseries Anomaly Detection Using an Autoencoder",
82
  description="Anomaly detection of timeseries data."
83
  )
 
15
  output = []
16
  for i in range(len(values) - time_steps + 1):
17
  output.append(values[i : (i + time_steps)])
18
+ return np.stack(output)
19
 
20
 
21
  def normalize_data(data):
 
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")
 
67
  plot1 = plot_test_data(df_test_value)
68
  # predict
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
 
 
77
  fn=master,
78
  inputs=gr.inputs.File(label="CSV File"),
79
  outputs=outputs,
80
+ examples=["example_1.csv", "example_2.csv"],
81
  title="Timeseries Anomaly Detection Using an Autoencoder",
82
  description="Anomaly detection of timeseries data."
83
  )