PeterYu commited on
Commit
aac28f7
·
1 Parent(s): ffdaaba
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -44,7 +44,7 @@ class TimeSeriesEditor:
44
  self.freq_bands = np.ones(5) # 5 frequency bands, initially all set to 1.0
45
  self.function_parser = FunctionParser()
46
  self.trending_controls = [
47
- (200, 250, 0, self.function_parser.string_to_function("sin(2*pi*x)"), 0.05)
48
  # 200,250,0,sin(2*pi*x),0.05
49
  ]
50
  self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
@@ -454,6 +454,9 @@ class TimeSeriesEditor:
454
  # model_control_signal=model_control_signal,
455
  gradient_control_signal=gradient_control_signal
456
  )
 
 
 
457
 
458
  # Store latest results
459
  self.latest_sample = sample
@@ -619,7 +622,7 @@ class TimeSeriesEditor:
619
  def create_gradio_interface(editor: TimeSeriesEditor):
620
  with gr.Blocks() as app:
621
  gr.Markdown("# Time Series Editor")
622
- gr.Markdown("## Instruction: Scroll Down + Click [Update Figure] [~20s]")
623
 
624
  metrics_display = gr.JSON(label="Metrics", value={})
625
 
@@ -658,7 +661,7 @@ def create_gradio_interface(editor: TimeSeriesEditor):
658
  headers=["time", "feature", "value"],
659
  datatype=["number", "number", "number"],
660
  # label="Anchor Point Control",
661
- value=[[0, 0, 0.04], [2, 0, 0.58], [6, 0, 0.27], [58, 0, 1.0], [60, 0, 0.5]],
662
  col_count=(3, "fixed"), # Fix number of columns
663
  interactive=True
664
  )
@@ -713,7 +716,7 @@ def create_gradio_interface(editor: TimeSeriesEditor):
713
 
714
  Separate multiple trends with semicolons.
715
  """)
716
- enable_trending_control = gr.Checkbox(label="Enable Trending Control", value=True)
717
  enable_trending_control_with_diff = gr.Checkbox(label="Consider Last Generated", value=False)
718
  trending_control = gr.Textbox(
719
  label="Trending Control Parameters",
 
44
  self.freq_bands = np.ones(5) # 5 frequency bands, initially all set to 1.0
45
  self.function_parser = FunctionParser()
46
  self.trending_controls = [
47
+ # (200, 250, 0, self.function_parser.string_to_function("sin(2*pi*x)"), 0.05)
48
  # 200,250,0,sin(2*pi*x),0.05
49
  ]
50
  self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
 
454
  # model_control_signal=model_control_signal,
455
  gradient_control_signal=gradient_control_signal
456
  )
457
+
458
+ observed_points = observed_points.cpu()
459
+ observed_mask = observed_mask.cpu()
460
 
461
  # Store latest results
462
  self.latest_sample = sample
 
622
  def create_gradio_interface(editor: TimeSeriesEditor):
623
  with gr.Blocks() as app:
624
  gr.Markdown("# Time Series Editor")
625
+ gr.Markdown("## Instruction: Scroll Down + Click [Update Figure] [~10s]")
626
 
627
  metrics_display = gr.JSON(label="Metrics", value={})
628
 
 
661
  headers=["time", "feature", "value"],
662
  datatype=["number", "number", "number"],
663
  # label="Anchor Point Control",
664
+ value=[[0, 0, 0.04], [2, 0, 0.58], [6, 0, 0.27], [58, 0, 0.8], [60, 0, 0.5]],
665
  col_count=(3, "fixed"), # Fix number of columns
666
  interactive=True
667
  )
 
716
 
717
  Separate multiple trends with semicolons.
718
  """)
719
+ enable_trending_control = gr.Checkbox(label="Enable Trending Control", value=False)
720
  enable_trending_control_with_diff = gr.Checkbox(label="Consider Last Generated", value=False)
721
  trending_control = gr.Textbox(
722
  label="Trending Control Parameters",