Spaces:
Sleeping
Sleeping
| FROM python:3.10-slim | |
| # Sistem bağımlılıkları ve temizlik | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends git gcc python3-dev && \ | |
| rm -rf /var/lib/apt/lists/* && \ | |
| mkdir -p /tmp/huggingface /tmp/offload && \ | |
| chmod 777 /tmp/huggingface /tmp/offload | |
| # Çalışma dizini ve ortam değişkenleri | |
| WORKDIR /app | |
| ENV HF_HOME=/tmp/huggingface \ | |
| TRANSFORMERS_CACHE=/tmp/huggingface \ | |
| PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:128 | |
| # Gerekli dosyaları kopyala | |
| COPY requirements.txt . | |
| COPY app.py . | |
| # Bağımlılıkları yükle | |
| RUN pip install --no-cache-dir -r requirements.txt && \ | |
| if [ "$(uname -m)" = "x86_64" ]; then \ | |
| pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu; \ | |
| else \ | |
| pip install --no-cache-dir torch; \ | |
| fi | |
| # Çalıştırma komutu | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"] |