Spaces:
Running
Running
File size: 2,020 Bytes
8572be5 6deee5a 8572be5 6deee5a 8572be5 6deee5a 8572be5 6deee5a f3634b6 6deee5a 8572be5 af666bf 6deee5a 8572be5 6deee5a 8572be5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | 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"]
|