fix: AI photo enhance modal stays open with result preview; fix basicsr build
- Modal no longer auto-closes after Real-ESRGAN completes; result loads into canvas so user can review, adjust sliders, and choose to apply or discard - Backend skips swapEntryPhotoFiles until user confirms via Применить - New DELETE /api/entries/:id/photo/enhance-ai/preview for temp file cleanup - photo-ai Dockerfile: patch basicsr via find+sed instead of import (avoids torchvision.functional_tensor import crash)
This commit is contained in:
+11
-9
@@ -4,18 +4,20 @@ WORKDIR /app
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends libgl1 libglib2.0-0 && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN pip install --no-cache-dir "typing-extensions==4.12.2" "numpy<2"
|
||||
|
||||
RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
|
||||
|
||||
RUN pip install --no-cache-dir realesrgan==0.3.0 fastapi "uvicorn[standard]" python-multipart opencv-python-headless numpy
|
||||
RUN pip install --no-cache-dir realesrgan==0.3.0 fastapi "uvicorn[standard]" python-multipart opencv-python-headless
|
||||
|
||||
RUN python - <<'EOF'
|
||||
import basicsr, os
|
||||
p = os.path.join(os.path.dirname(basicsr.__file__), 'data', 'degradations.py')
|
||||
s = open(p).read()
|
||||
s = s.replace('torchvision.transforms.functional_tensor', 'torchvision.transforms.functional')
|
||||
open(p, 'w').write(s)
|
||||
print('basicsr patch applied')
|
||||
EOF
|
||||
RUN BASICSR_DEG=$(python -c "import basicsr; import os; print(os.path.join(os.path.dirname(basicsr.__file__), 'data', 'degradations.py'))" 2>/dev/null) || \
|
||||
BASICSR_DEG=$(find /usr/local/lib/python3.10 -path "*/basicsr/data/degradations.py" 2>/dev/null | head -1) && \
|
||||
if [ -n "$BASICSR_DEG" ]; then \
|
||||
sed -i 's/from torchvision.transforms.functional_tensor/from torchvision.transforms.functional/g' "$BASICSR_DEG" && \
|
||||
echo "basicsr patch applied to $BASICSR_DEG"; \
|
||||
else \
|
||||
echo "basicsr degradations.py not found, skipping patch"; \
|
||||
fi
|
||||
|
||||
COPY app.py .
|
||||
|
||||
|
||||
Reference in New Issue
Block a user