Spaces:
Running
Running
fix
Browse files- py_backend/Dockerfile +0 -30
- py_backend/app/main.py +7 -0
py_backend/Dockerfile
DELETED
|
@@ -1,30 +0,0 @@
|
|
| 1 |
-
FROM python:3.11-slim
|
| 2 |
-
|
| 3 |
-
# Build deps for psycopg2 etc.
|
| 4 |
-
RUN apt-get update && apt-get install -y \
|
| 5 |
-
build-essential gcc libpq-dev \
|
| 6 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 7 |
-
|
| 8 |
-
WORKDIR /app
|
| 9 |
-
|
| 10 |
-
# Install deps first for caching
|
| 11 |
-
COPY requirements.txt /tmp/requirements.txt
|
| 12 |
-
RUN pip install --no-cache-dir -r /tmp/requirements.txt
|
| 13 |
-
|
| 14 |
-
# Copy backend code
|
| 15 |
-
COPY . /app/
|
| 16 |
-
|
| 17 |
-
# Create data directory for persistent storage
|
| 18 |
-
RUN mkdir -p /data/uploads && chmod -R 777 /data
|
| 19 |
-
|
| 20 |
-
# Set environment variables
|
| 21 |
-
ENV DATABASE_URL=sqlite:////data/app.db
|
| 22 |
-
ENV STORAGE_PROVIDER=local
|
| 23 |
-
ENV STORAGE_DIR=/data/uploads
|
| 24 |
-
ENV HF_HOME=/data/.cache/huggingface
|
| 25 |
-
ENV PORT=7860
|
| 26 |
-
|
| 27 |
-
EXPOSE 7860
|
| 28 |
-
|
| 29 |
-
# Use shell form for proper environment variable substitution
|
| 30 |
-
CMD uvicorn app.main:app --host 0.0.0.0 --port $PORT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
py_backend/app/main.py
CHANGED
|
@@ -49,6 +49,13 @@ def spa_fallback(full_path: str):
|
|
| 49 |
return FileResponse(index)
|
| 50 |
raise HTTPException(status_code=404, detail="Not Found")
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
print("π PromptAid Vision API server ready")
|
| 54 |
print("π Endpoints: /api/images, /api/captions, /api/metadata, /api/models")
|
|
|
|
| 49 |
return FileResponse(index)
|
| 50 |
raise HTTPException(status_code=404, detail="Not Found")
|
| 51 |
|
| 52 |
+
@app.get("/debug")
|
| 53 |
+
async def debug():
|
| 54 |
+
return {
|
| 55 |
+
"message": "Backend is working",
|
| 56 |
+
"timestamp": datetime.now().isoformat(),
|
| 57 |
+
"routes": [route.path for route in app.routes]
|
| 58 |
+
}
|
| 59 |
|
| 60 |
print("π PromptAid Vision API server ready")
|
| 61 |
print("π Endpoints: /api/images, /api/captions, /api/metadata, /api/models")
|