Abhijeet Mahapatra commited on
Commit
da8585e
Β·
1 Parent(s): 2365e13

Fixe s for HF hosting

Browse files
Files changed (2) hide show
  1. app.py +4 -8
  2. requirements.txt +1 -0
app.py CHANGED
@@ -63,7 +63,7 @@ logger = logging.getLogger("dashboard-server")
63
  # Backend URL
64
  # ─────────────────────────────────────────────────────────────────────────────
65
 
66
- _BACKEND_BASE_URL: str = os.environ.get("BACKEND_API_URL", "http://localhost:7860")
67
 
68
 
69
  # ─────────────────────────────────────────────────────────────────────────────
@@ -160,12 +160,6 @@ def run_pipeline(
160
  # Helpers
161
  # ─────────────────────────────────────────────────────────────────────────────
162
 
163
- # URL of the noisy_boy_backend β€” used to fetch the validated causal matrix.
164
- # By default, point to ourselves since we now successfully mount the backend routers.
165
- # Override via BACKEND_API_URL env var if running a separate backend on 8000.
166
- _BACKEND_BASE_URL = os.environ.get("BACKEND_API_URL", "http://localhost:7860")
167
-
168
-
169
  def _fetch_causal_matrix(
170
  ticker: str,
171
  treatment: Optional[str] = None,
@@ -404,8 +398,9 @@ def _abduct_and_predict(
404
  # 2. Use the payload data (equations, adj, data_level) for inference
405
  # using pure numpy/pandas β€” no local causal training imports required.
406
  # 3. Optionally consult pywhyllm guidance from the backend payload.
 
407
 
408
-
409
  def run_inference(
410
  ticker: str = "RELIANCE",
411
  mode: str = "assert",
@@ -877,4 +872,5 @@ if __name__ == "__main__":
877
  server_name=host,
878
  server_port=port,
879
  show_error=True,
 
880
  )
 
63
  # Backend URL
64
  # ─────────────────────────────────────────────────────────────────────────────
65
 
66
+ _BACKEND_BASE_URL: str = os.environ.get("BACKEND_API_URL", "http://localhost:8000")
67
 
68
 
69
  # ─────────────────────────────────────────────────────────────────────────────
 
160
  # Helpers
161
  # ─────────────────────────────────────────────────────────────────────────────
162
 
 
 
 
 
 
 
163
  def _fetch_causal_matrix(
164
  ticker: str,
165
  treatment: Optional[str] = None,
 
398
  # 2. Use the payload data (equations, adj, data_level) for inference
399
  # using pure numpy/pandas β€” no local causal training imports required.
400
  # 3. Optionally consult pywhyllm guidance from the backend payload.
401
+ from huggingface_hub import spaces
402
 
403
+ @spaces.GPU
404
  def run_inference(
405
  ticker: str = "RELIANCE",
406
  mode: str = "assert",
 
872
  server_name=host,
873
  server_port=port,
874
  show_error=True,
875
+ ssr_mode="cdn"
876
  )
requirements.txt CHANGED
@@ -28,6 +28,7 @@ packaging==26.0
28
  pandas==2.3.3
29
  pillow==12.2.0
30
  pydantic==2.12.5
 
31
  pydub==0.25.1
32
  Pygments==2.20.0
33
  python-dateutil==2.9.0.post0
 
28
  pandas==2.3.3
29
  pillow==12.2.0
30
  pydantic==2.12.5
31
+ pydantic_core==2.41.5
32
  pydub==0.25.1
33
  Pygments==2.20.0
34
  python-dateutil==2.9.0.post0