FROM python:3.11-slim WORKDIR /app # 基础依赖(kiwipiepy 有时需要编译环境;装上更稳) RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential gcc g++ \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt /app/requirements.txt RUN pip install -U pip && pip install --no-cache-dir -r requirements.txt COPY . /app # Gradio 在 Spaces 默认用 7860 ENV GRADIO_SERVER_NAME=0.0.0.0 ENV GRADIO_SERVER_PORT=7860 CMD ["python", "app.py"]