Spaces:
Running
Running
FROM python:3.10-slim | |
WORKDIR /code | |
# System dependencies | |
RUN apt-get update && apt-get install -y \ | |
libsndfile1 ffmpeg git \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Copy project files | |
COPY . /code | |
# Set safe cache + config + data paths | |
ENV PYTHONDONTWRITEBYTECODE=1 | |
ENV PYTHONUNBUFFERED=1 | |
ENV HF_HOME=/tmp/hf-home | |
ENV TRANSFORMERS_CACHE=/tmp/hf-cache | |
ENV NLTK_DATA=/tmp/nltk_data | |
# Fix Streamlit writing to restricted folder | |
ENV HOME=/tmp | |
ENV XDG_CONFIG_HOME=/tmp | |
# Install Python dependencies | |
RUN pip install --upgrade pip | |
RUN pip install -r requirements.txt | |
RUN pip install fastapi uvicorn transformers openai python-multipart gtts pillow pandas streamlit | |
# β Allow Streamlit to write telemetry & config | |
RUN mkdir -p /tmp/.streamlit && chmod -R 777 /tmp/.streamlit | |
# Expose ports | |
EXPOSE 7860 | |
EXPOSE 8000 | |
# Final launch command | |
CMD ["bash", "-c", "streamlit run frontend.py --server.port 7860 & uvicorn main:app --host 0.0.0.0 --port 8000"] | |