fix: Install mediagallery at runtime for HF Spaces
Browse files- Dockerfile +0 -19
- app.py +6 -0
Dockerfile
DELETED
|
@@ -1,19 +0,0 @@
|
|
| 1 |
-
FROM python:3.10-slim
|
| 2 |
-
|
| 3 |
-
RUN apt-get update && apt-get install -y \
|
| 4 |
-
ffmpeg \
|
| 5 |
-
git \
|
| 6 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 7 |
-
|
| 8 |
-
RUN useradd -m -u 1000 user
|
| 9 |
-
WORKDIR /home/user/app
|
| 10 |
-
|
| 11 |
-
COPY --chown=user requirements.txt .
|
| 12 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 13 |
-
|
| 14 |
-
COPY --chown=user . .
|
| 15 |
-
RUN pip install --no-cache-dir ./mediagallery
|
| 16 |
-
|
| 17 |
-
USER user
|
| 18 |
-
|
| 19 |
-
CMD ["python", "app.py"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import spaces
|
| 3 |
from gradio_mediagallery import MediaGallery
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
# Install local mediagallery package at runtime (for HF Spaces)
|
| 5 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "-q", "./mediagallery"])
|
| 6 |
+
|
| 7 |
import gradio as gr
|
| 8 |
import spaces
|
| 9 |
from gradio_mediagallery import MediaGallery
|