Spaces:
Build error
Build error
dockerise
Browse files- .dockerignore +12 -0
- Dockerfile +23 -0
- Makefile +21 -0
- README.md +17 -1
- app.py +4 -1
- docker-compose.yml +12 -0
.dockerignore
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.git
|
| 2 |
+
.gitignore
|
| 3 |
+
.venv
|
| 4 |
+
__pycache__/
|
| 5 |
+
.ipynb_checkpoints/
|
| 6 |
+
*.py[cod]
|
| 7 |
+
*.ipynb
|
| 8 |
+
.DS_Store
|
| 9 |
+
debug_frames/
|
| 10 |
+
force_06/
|
| 11 |
+
out*.mp4
|
| 12 |
+
output.png
|
Dockerfile
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11-slim
|
| 2 |
+
|
| 3 |
+
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 4 |
+
PYTHONUNBUFFERED=1 \
|
| 5 |
+
PIP_NO_CACHE_DIR=1 \
|
| 6 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
| 7 |
+
GRADIO_SERVER_PORT=7860
|
| 8 |
+
|
| 9 |
+
WORKDIR /app
|
| 10 |
+
|
| 11 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 12 |
+
ffmpeg \
|
| 13 |
+
libgomp1 \
|
| 14 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
+
|
| 16 |
+
COPY requirements.txt .
|
| 17 |
+
RUN pip install --upgrade pip && pip install -r requirements.txt
|
| 18 |
+
|
| 19 |
+
COPY . .
|
| 20 |
+
|
| 21 |
+
EXPOSE 7860
|
| 22 |
+
|
| 23 |
+
CMD ["python", "app.py"]
|
Makefile
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
COMPOSE := docker compose
|
| 2 |
+
|
| 3 |
+
.PHONY: run run-bg stop down logs build ps
|
| 4 |
+
|
| 5 |
+
run:
|
| 6 |
+
$(COMPOSE) up --build -d
|
| 7 |
+
|
| 8 |
+
stop:
|
| 9 |
+
$(COMPOSE) stop
|
| 10 |
+
|
| 11 |
+
down:
|
| 12 |
+
$(COMPOSE) down
|
| 13 |
+
|
| 14 |
+
logs:
|
| 15 |
+
$(COMPOSE) logs -f app
|
| 16 |
+
|
| 17 |
+
build:
|
| 18 |
+
$(COMPOSE) build
|
| 19 |
+
|
| 20 |
+
ps:
|
| 21 |
+
$(COMPOSE) ps
|
README.md
CHANGED
|
@@ -35,6 +35,22 @@ python app.py
|
|
| 35 |
Gradio will print a local URL (for example, `http://127.0.0.1:7860`). Open it
|
| 36 |
in your browser, upload an MP4, and click "Detect".
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
## Notes
|
| 39 |
- The first run downloads the wildfire detection model from Hugging Face.
|
| 40 |
-
-
|
|
|
|
|
|
| 35 |
Gradio will print a local URL (for example, `http://127.0.0.1:7860`). Open it
|
| 36 |
in your browser, upload an MP4, and click "Detect".
|
| 37 |
|
| 38 |
+
## Docker Compose + Make
|
| 39 |
+
Run with:
|
| 40 |
+
```bash
|
| 41 |
+
make run
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
Other commands:
|
| 45 |
+
```bash
|
| 46 |
+
make logs
|
| 47 |
+
make stop
|
| 48 |
+
make down
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
Then open `http://127.0.0.1:7860` in your browser.
|
| 52 |
+
|
| 53 |
## Notes
|
| 54 |
- The first run downloads the wildfire detection model from Hugging Face.
|
| 55 |
+
- `ffmpeg`/`ffprobe` are required for frame extraction.
|
| 56 |
+
- OpenCV is used for motion features and image processing.
|
app.py
CHANGED
|
@@ -646,4 +646,7 @@ with gr.Blocks() as demo:
|
|
| 646 |
|
| 647 |
|
| 648 |
if __name__ == "__main__":
|
| 649 |
-
demo.launch(
|
|
|
|
|
|
|
|
|
|
|
|
| 646 |
|
| 647 |
|
| 648 |
if __name__ == "__main__":
|
| 649 |
+
demo.launch(
|
| 650 |
+
server_name=os.getenv("GRADIO_SERVER_NAME", "127.0.0.1"),
|
| 651 |
+
server_port=int(os.getenv("GRADIO_SERVER_PORT", "7860")),
|
| 652 |
+
)
|
docker-compose.yml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
services:
|
| 2 |
+
app:
|
| 3 |
+
build:
|
| 4 |
+
context: .
|
| 5 |
+
dockerfile: Dockerfile
|
| 6 |
+
container_name: pyronear-wildfire-detection
|
| 7 |
+
ports:
|
| 8 |
+
- "7860:7860"
|
| 9 |
+
environment:
|
| 10 |
+
GRADIO_SERVER_NAME: "0.0.0.0"
|
| 11 |
+
GRADIO_SERVER_PORT: "7860"
|
| 12 |
+
restart: unless-stopped
|