Jitendra12421 commited on
Commit
0d893fe
·
verified ·
1 Parent(s): 57c09ef

Upload 6 files

Browse files
Files changed (2) hide show
  1. app.py +7 -1
  2. requirements.txt +1 -1
app.py CHANGED
@@ -75,7 +75,13 @@ def train():
75
  def tick():
76
  global MODELS
77
  if MODELS is None:
78
- MODELS=joblib.load(ROOT / "models.joblib") if (ROOT / "models.joblib").exists() else train()
 
 
 
 
 
 
79
  live=get_candles(); hist=pd.read_parquet(DATA).tail(5000)
80
  hist["epoch"]=(pd.to_datetime(hist.timestamp,utc=True).astype("int64")//10**9)
81
  d=pd.concat([hist,live],ignore_index=True).drop_duplicates("epoch",keep="last").sort_values("epoch").reset_index(drop=True)
 
75
  def tick():
76
  global MODELS
77
  if MODELS is None:
78
+ if (ROOT / "models.joblib").exists():
79
+ try:
80
+ MODELS=joblib.load(ROOT / "models.joblib")
81
+ except Exception:
82
+ MODELS=train()
83
+ else:
84
+ MODELS=train()
85
  live=get_candles(); hist=pd.read_parquet(DATA).tail(5000)
86
  hist["epoch"]=(pd.to_datetime(hist.timestamp,utc=True).astype("int64")//10**9)
87
  d=pd.concat([hist,live],ignore_index=True).drop_duplicates("epoch",keep="last").sort_values("epoch").reset_index(drop=True)
requirements.txt CHANGED
@@ -1,6 +1,6 @@
1
  requests
2
  pandas
3
  pyarrow
4
- scikit-learn
5
  joblib
6
  gradio==6.23.1
 
1
  requests
2
  pandas
3
  pyarrow
4
+ scikit-learn==1.8.0
5
  joblib
6
  gradio==6.23.1