Spaces:
Running
Running
| FROM python:3.11-slim | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| git build-essential curl wget \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create user matching HF Space conventions | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH | |
| WORKDIR /home/user/app | |
| # Disable TiRex CUDA kernels (we're on CPU-only Space) | |
| ENV TIREX_NO_CUDA=1 XLSTM_USE_CUDA_KERNELS=0 | |
| # Core: Torch CPU (keep 2.4.1 β Kronos meta-tensor compatibility) | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir torch==2.4.1 --index-url https://download.pytorch.org/whl/cpu | |
| # Transformers bumped to 4.55.0 for TimesFm2_5 support | |
| RUN pip install --no-cache-dir \ | |
| "transformers==4.55.0" \ | |
| "huggingface_hub>=0.27.0,<1.0" \ | |
| "gradio[mcp]==5.30.0" \ | |
| "websockets>=13" \ | |
| "einops" \ | |
| "safetensors" \ | |
| "pandas" \ | |
| "numpy<2.3" | |
| # Chronos + TimesFM (fallback) + yfinance + sentiment | |
| RUN pip install --no-cache-dir \ | |
| "chronos-forecasting>=1.5.2" \ | |
| "timesfm[torch]>=1.3.0" \ | |
| "yfinance>=0.2.50" \ | |
| "curl_cffi>=0.7" \ | |
| "sentencepiece" \ | |
| "tokenizers" | |
| # NEW: MOMENT (anomaly detection) | |
| RUN pip install --no-cache-dir "momentfm>=0.1.4" | |
| # NEW: GDELT (news streaming) | |
| RUN pip install --no-cache-dir "gdeltdoc>=1.5.0" | |
| # NEW: requests for Reddit | |
| RUN pip install --no-cache-dir "requests>=2.31" "beautifulsoup4>=4.12" | |
| # NEW: TiRex (xLSTM TSFM) β install from git, CPU experimental mode | |
| # Use || true so build doesn't fail if tirex install hits issues β endpoint will error gracefully | |
| RUN pip install --no-cache-dir git+https://github.com/NX-AI/tirex.git || \ | |
| echo "WARNING: TiRex install failed β /forecast_tirex will return error" | |
| # Kronos model repo | |
| USER user | |
| RUN mkdir -p /home/user/app/model | |
| COPY --chown=user ./model /home/user/app/model | |
| COPY --chown=user ./app.py /home/user/app/app.py | |
| # Pre-create HF cache dirs with right perms | |
| RUN mkdir -p /home/user/.cache/huggingface | |
| EXPOSE 7860 | |
| CMD ["python", "app.py"] | |