Nuzz23 commited on
Commit
a5368e1
·
1 Parent(s): 33770c1

added global

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -15,6 +15,12 @@ OUT_PATH ="./savedPredictions/results.csv"
15
  def dataProcessing(file, timestamp_column:str=None):
16
  if os.path.exists(OUT_PATH):
17
  os.remove(OUT_PATH)
 
 
 
 
 
 
18
  try:
19
  validateData(file, timestamp_column)
20
  preProcessedData, timestamp_old, target_cols = preProcessData(file, timestamp_column)
@@ -79,7 +85,7 @@ with gr.Blocks(title="Time series anomaly detection with Chronos2") as demo:
79
  interactive=True,
80
 
81
  )
82
- timestamp_column_input = gr.Textbox(label="If yes, please specify the column name of the timestamp:", visible=False, value="", interactive=False)
83
 
84
  timestamp_question.change(
85
  lambda x: gr.update(visible=(x == "Yes"), interactive=(x == "Yes"), value="timestamp" if x == "Yes" else ""),
@@ -95,11 +101,6 @@ with gr.Blocks(title="Time series anomaly detection with Chronos2") as demo:
95
  errorHandler = gr.Markdown(label="Error Messages", visible=False)
96
 
97
  processing_msg = gr.Markdown("⏳ Processing file, please wait...", visible=False)
98
- detect_button.click(
99
- lambda : gr.update(visible=False, value=""),
100
- inputs=None,
101
- outputs=[plot_output, download_output, errorHandler]
102
- )
103
 
104
  detect_button.click(
105
  lambda : gr.update(visible=True),
 
15
  def dataProcessing(file, timestamp_column:str=None):
16
  if os.path.exists(OUT_PATH):
17
  os.remove(OUT_PATH)
18
+ global plot, download, error, chronos2
19
+
20
+ plot = gr.update(visible=False)
21
+ download = gr.update(visible=False)
22
+ error = gr.update(visible=False)
23
+
24
  try:
25
  validateData(file, timestamp_column)
26
  preProcessedData, timestamp_old, target_cols = preProcessData(file, timestamp_column)
 
85
  interactive=True,
86
 
87
  )
88
+ timestamp_column_input = gr.Textbox(label="Please specify the column name of the timestamp:", visible=False, value="", interactive=False)
89
 
90
  timestamp_question.change(
91
  lambda x: gr.update(visible=(x == "Yes"), interactive=(x == "Yes"), value="timestamp" if x == "Yes" else ""),
 
101
  errorHandler = gr.Markdown(label="Error Messages", visible=False)
102
 
103
  processing_msg = gr.Markdown("⏳ Processing file, please wait...", visible=False)
 
 
 
 
 
104
 
105
  detect_button.click(
106
  lambda : gr.update(visible=True),