Spaces:
Sleeping
Sleeping
Upload 4 files
Browse files- Dockerfile +25 -0
- app.py +3 -4
Dockerfile
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Dockerfile
|
| 2 |
+
|
| 3 |
+
# Base image: lightweight Python 3.9
|
| 4 |
+
FROM python:3.9-slim
|
| 5 |
+
|
| 6 |
+
# Install system packages if needed (none strictly required here)
|
| 7 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 8 |
+
gcc \
|
| 9 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
+
|
| 11 |
+
# Set work directory
|
| 12 |
+
WORKDIR /app
|
| 13 |
+
|
| 14 |
+
# Copy requirements and install
|
| 15 |
+
COPY requirements.txt .
|
| 16 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 17 |
+
|
| 18 |
+
# Copy our application code
|
| 19 |
+
COPY app.py .
|
| 20 |
+
|
| 21 |
+
# Expose port 7860 (Gradio + Flask)
|
| 22 |
+
EXPOSE 7860
|
| 23 |
+
|
| 24 |
+
# Launch the combined Flask + Gradio server
|
| 25 |
+
CMD ["python", "app.py"]
|
app.py
CHANGED
|
@@ -248,11 +248,10 @@ with gr.Blocks(fill_height=True) as demo:
|
|
| 248 |
""")
|
| 249 |
|
| 250 |
|
| 251 |
-
def _ensure_routes() -> None:
|
| 252 |
-
|
| 253 |
-
|
| 254 |
|
| 255 |
-
demo.load(fn=_ensure_routes, inputs=None, outputs=None)
|
| 256 |
|
| 257 |
|
| 258 |
def build_app() -> gr.Blocks:
|
|
|
|
| 248 |
""")
|
| 249 |
|
| 250 |
|
| 251 |
+
def _ensure_routes() -> None:
|
| 252 |
+
register_backend_routes(demo)
|
|
|
|
| 253 |
|
| 254 |
+
demo.load(fn=_ensure_routes, inputs=None, outputs=None)
|
| 255 |
|
| 256 |
|
| 257 |
def build_app() -> gr.Blocks:
|