ranranrunforit commited on
Commit
7858883
·
verified ·
1 Parent(s): ae8671d

Upload requirements.txt

Browse files
Files changed (1) hide show
  1. requirements.txt +7 -64
requirements.txt CHANGED
@@ -1,64 +1,7 @@
1
- """
2
- paths.py — persistent storage layout on the Hugging Face storage bucket (/data).
3
-
4
- If /data exists and is writable (the Space has a storage bucket attached),
5
- everything that should survive restarts/sleep lives there:
6
-
7
- /data/cache_us market-data parquet cache (yfinance downloads)
8
- /data/output signal CSVs, holdings.txt
9
- /data/reports auto-generated research reports (markdown)
10
- /data/traces agent traces (JSON) — shareable on the Hub (📡 badge)
11
- /data/hf_cache GGUF model files (downloaded once, kept forever)
12
- /data/pylibs llama-cpp-python installed once at runtime, persisted
13
-
14
- Without a bucket the app still works — it just falls back to the container
15
- filesystem (wiped on restart).
16
- """
17
- from __future__ import annotations
18
-
19
- import os
20
- import sys
21
-
22
-
23
- def _writable(p: str) -> bool:
24
- try:
25
- return os.path.isdir(p) and os.access(p, os.W_OK)
26
- except OSError:
27
- return False
28
-
29
-
30
- DATA_ROOT = "/data" if _writable("/data") else "."
31
- PERSISTENT = DATA_ROOT == "/data"
32
-
33
- CACHE_DIR = os.path.join(DATA_ROOT, "cache_us")
34
- OUTPUT_DIR = os.path.join(DATA_ROOT, "output") if PERSISTENT else "./_app_output"
35
- REPORTS_DIR = os.path.join(DATA_ROOT, "reports")
36
- TRACES_DIR = os.path.join(DATA_ROOT, "traces")
37
- DATASET_DIR = os.path.join(DATA_ROOT, "dataset") # SFT training pairs (JSONL)
38
- HF_CACHE_DIR = os.path.join(DATA_ROOT, "hf_cache")
39
- PYLIBS_DIR = os.path.join(DATA_ROOT, "pylibs")
40
-
41
- for _d in (CACHE_DIR, OUTPUT_DIR, REPORTS_DIR, TRACES_DIR, DATASET_DIR, HF_CACHE_DIR, PYLIBS_DIR):
42
- try:
43
- os.makedirs(_d, exist_ok=True)
44
- except OSError:
45
- pass
46
-
47
- # GGUF downloads (hf_hub_download) go to the bucket so models persist
48
- if PERSISTENT:
49
- os.environ.setdefault("HF_HOME", HF_CACHE_DIR)
50
-
51
- # llama-cpp-python installed into the bucket must be importable.
52
- # APPEND (not insert) so bucket-installed copies of common deps (numpy etc.)
53
- # can never shadow the system site-packages the app was built against.
54
- if PERSISTENT and PYLIBS_DIR not in sys.path:
55
- sys.path.append(PYLIBS_DIR)
56
-
57
-
58
- def storage_status() -> str:
59
- if PERSISTENT:
60
- return ("✅ Persistent storage bucket mounted at `/data` — data cache, "
61
- "model files, reports, traces and the llama.cpp runtime all "
62
- "survive restarts.")
63
- return ("⚠️ No `/data` bucket detected — running on ephemeral container "
64
- "storage (everything re-downloads after a restart).")
 
1
+ gradio>=5.49
2
+ pandas>=2.0
3
+ numpy>=1.24
4
+ pyarrow>=14
5
+ yfinance>=0.2.40
6
+ apscheduler>=3.10
7
+ huggingface_hub>=0.23