wayne-chi commited on
Commit
c43791e
·
verified ·
1 Parent(s): 35aaf0c

Update test_app.py

Browse files
Files changed (1) hide show
  1. test_app.py +26 -17
test_app.py CHANGED
@@ -1,16 +1,4 @@
1
- import pandas as pd
2
- import matplotlib
3
- import matplotlib.pyplot as plt
4
- import plotly.express as px
5
- import numpy as np
6
- import plotly.graph_objects as go
7
- import sqlite3
8
- from typing import Optional, Dict, Any
9
- from datetime import datetime, timedelta
10
- import re
11
- from pathlib import Path
12
-
13
-
14
  # import torch
15
 
16
  # # Give torch.classes a benign __path__ so Streamlit won't trigger __getattr__.
@@ -26,7 +14,29 @@ from pathlib import Path
26
  # return getattr(self._obj, name)
27
  # torch.classes = _TorchClassesWrapper(torch.classes)
28
 
29
- import streamlit as st
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
  ##---- fucntions ------
32
  # Load fuel data from CSV (create this file if it doesn't exist)
@@ -622,8 +632,7 @@ def get_model(db_path="eagleblend.db"):
622
  # Dashboard Tab
623
  # ----------------------------------------------------------------------------------------------------------------------------------------------
624
  with tabs[0]:
625
- import math
626
- import plotly.graph_objects as go
627
 
628
  # NOTE: Assuming these functions are defined elsewhere in your application
629
  # from your_utils import get_model, get_activity_logs, get_blends_overview
@@ -1306,7 +1315,7 @@ with tabs[1]:
1306
  # Optimization Engine Tab
1307
  # ----------------------------------------------------------------------------------------------------------------------------------------------
1308
 
1309
- import time # Add this import to the top of your script
1310
 
1311
  # --- Add this new function to your functions section ---
1312
  def dummy_optimization_function(targets, fixed_targets, components_data):
 
1
+ import streamlit as st
 
 
 
 
 
 
 
 
 
 
 
 
2
  # import torch
3
 
4
  # # Give torch.classes a benign __path__ so Streamlit won't trigger __getattr__.
 
14
  # return getattr(self._obj, name)
15
  # torch.classes = _TorchClassesWrapper(torch.classes)
16
 
17
+
18
+
19
+ if "modules_loaded" not in st.session_state:
20
+ # Do your big imports or setup here
21
+ # import torch
22
+ from predictor import EagleBlendPredictor
23
+ import pandas as pd
24
+ import matplotlib
25
+ import matplotlib.pyplot as plt
26
+ import plotly.express as px
27
+ import numpy as np
28
+ import plotly.graph_objects as go
29
+ import sqlite3
30
+ from typing import Optional, Dict, Any
31
+ from datetime import datetime, timedelta
32
+ import re
33
+ from pathlib import Path
34
+ import time # Add this import to the top of your script
35
+ import math
36
+ import plotly.graph_objects as go
37
+
38
+ st.session_state["modules_loaded"] = True
39
+
40
 
41
  ##---- fucntions ------
42
  # Load fuel data from CSV (create this file if it doesn't exist)
 
632
  # Dashboard Tab
633
  # ----------------------------------------------------------------------------------------------------------------------------------------------
634
  with tabs[0]:
635
+
 
636
 
637
  # NOTE: Assuming these functions are defined elsewhere in your application
638
  # from your_utils import get_model, get_activity_logs, get_blends_overview
 
1315
  # Optimization Engine Tab
1316
  # ----------------------------------------------------------------------------------------------------------------------------------------------
1317
 
1318
+
1319
 
1320
  # --- Add this new function to your functions section ---
1321
  def dummy_optimization_function(targets, fixed_targets, components_data):