Spaces:
Running
Running
Commit
·
e4c6340
1
Parent(s):
22144cf
Added docker
Browse files- Dockerfile +20 -20
- README.md +26 -6
Dockerfile
CHANGED
|
@@ -1,33 +1,33 @@
|
|
| 1 |
-
FROM python:3.10-slim
|
| 2 |
|
|
|
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 11 |
-
wget xz-utils ca-certificates && \
|
| 12 |
-
rm -rf /var/lib/apt/lists/*
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
RUN wget -O /tmp/ffmpeg.tar.xz https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz && \
|
| 16 |
-
mkdir -p /opt/ffmpeg && \
|
| 17 |
-
tar -xJf /tmp/ffmpeg.tar.xz -C /opt/ffmpeg --strip-components=1 && \
|
| 18 |
-
ln -s /opt/ffmpeg/ffmpeg /usr/local/bin/ffmpeg && \
|
| 19 |
-
ln -s /opt/ffmpeg/ffprobe /usr/local/bin/ffprobe && \
|
| 20 |
-
ffmpeg -version && ffprobe -version
|
| 21 |
|
|
|
|
|
|
|
| 22 |
|
| 23 |
WORKDIR /app
|
|
|
|
|
|
|
| 24 |
COPY requirements.txt ./
|
| 25 |
-
RUN pip install -r requirements.txt
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
|
|
|
| 28 |
COPY scripts ./scripts
|
| 29 |
COPY app.py ./app.py
|
| 30 |
|
| 31 |
-
|
| 32 |
EXPOSE 7860
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
CMD ["python", "app.py"]
|
|
|
|
|
|
|
| 1 |
|
| 2 |
+
FROM jrottenberg/ffmpeg:8-ubuntu-edge
|
| 3 |
|
| 4 |
+
# Install Python and dependencies
|
| 5 |
+
RUN apt-get update && \
|
| 6 |
+
apt-get install -y --no-install-recommends \
|
| 7 |
+
python3 python3-pip python3-venv python3-dev \
|
| 8 |
+
build-essential wget ca-certificates && \
|
| 9 |
+
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
# Set python/pip aliases
|
| 12 |
+
RUN ln -s /usr/bin/python3 /usr/bin/python
|
| 13 |
|
| 14 |
WORKDIR /app
|
| 15 |
+
|
| 16 |
+
# Copy requirements and install Python packages
|
| 17 |
COPY requirements.txt ./
|
|
|
|
| 18 |
|
| 19 |
+
# Create virtual environment and install requirements
|
| 20 |
+
RUN python3 -m venv /opt/venv \
|
| 21 |
+
&& /opt/venv/bin/pip install --upgrade pip \
|
| 22 |
+
&& /opt/venv/bin/pip install -r requirements.txt
|
| 23 |
|
| 24 |
+
# Copy app code
|
| 25 |
COPY scripts ./scripts
|
| 26 |
COPY app.py ./app.py
|
| 27 |
|
|
|
|
| 28 |
EXPOSE 7860
|
| 29 |
+
|
| 30 |
+
ENV PATH="/opt/venv/bin:$PATH"
|
| 31 |
+
|
| 32 |
+
ENTRYPOINT []
|
| 33 |
CMD ["python", "app.py"]
|
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
emoji: 🔥
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: green
|
|
@@ -7,12 +7,28 @@ sdk: docker
|
|
| 7 |
pinned: false
|
| 8 |
---
|
| 9 |
|
|
|
|
| 10 |
# 🔧 Glitch Video Generator
|
| 11 |
|
| 12 |
-
This Space wraps `scripts/glitch.py` and converts an image into a glitched video using **FFmpeg/ffprobe
|
| 13 |
You can use it from the **web UI** or programmatically via the **API**.
|
| 14 |
|
| 15 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
1. Open the Space.
|
| 17 |
2. Paste an **image URL** or upload an image.
|
| 18 |
3. Set the **duration (seconds)** and optional parameters.
|
|
@@ -62,10 +78,14 @@ JSON
|
|
| 62 |
```
|
| 63 |
|
| 64 |
|
| 65 |
-
🛠️ Requirements
|
| 66 |
|
| 67 |
-
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
|
| 71 |
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Glitch Image
|
| 3 |
emoji: 🔥
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: green
|
|
|
|
| 7 |
pinned: false
|
| 8 |
---
|
| 9 |
|
| 10 |
+
|
| 11 |
# 🔧 Glitch Video Generator
|
| 12 |
|
| 13 |
+
This Space wraps `scripts/glitch.py` and converts an image into a glitched video using **FFmpeg/ffprobe v8** (via Docker).
|
| 14 |
You can use it from the **web UI** or programmatically via the **API**.
|
| 15 |
|
| 16 |
+
## � Docker-based Deployment (Hugging Face Spaces)
|
| 17 |
+
|
| 18 |
+
This Space is configured to use a custom Docker image for deployment. The Dockerfile installs all dependencies, including FFmpeg, Python, and required Python packages, and overrides the default ffmpeg entrypoint so the Gradio app runs as expected.
|
| 19 |
+
|
| 20 |
+
**You do not need to install anything manually on Hugging Face Spaces.**
|
| 21 |
+
|
| 22 |
+
If you want to run locally:
|
| 23 |
+
|
| 24 |
+
```bash
|
| 25 |
+
docker build -t image-glitcher .
|
| 26 |
+
docker run -p 7860:7860 image-glitcher
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
The app will be available at http://localhost:7860
|
| 30 |
+
|
| 31 |
+
## �🚀 Usage (UI)
|
| 32 |
1. Open the Space.
|
| 33 |
2. Paste an **image URL** or upload an image.
|
| 34 |
3. Set the **duration (seconds)** and optional parameters.
|
|
|
|
| 78 |
```
|
| 79 |
|
| 80 |
|
|
|
|
| 81 |
|
| 82 |
+
🛠️ Requirements (for local non-Docker use)
|
| 83 |
+
|
| 84 |
+
- FFmpeg/ffprobe v8 (or higher)
|
| 85 |
+
- Python 3.10+
|
| 86 |
+
- gradio, pillow, glitch-this, requests
|
| 87 |
+
|
| 88 |
+
For Hugging Face Spaces, all requirements are handled by the Dockerfile.
|
| 89 |
|
| 90 |
|
| 91 |
|