Spaces:
Runtime error
Runtime error
Add Docker support (#2)
Browse files- Add Dockerfile (2f226c408aa03149ab91f1410829509e49894bb9)
- Add Docker Compose (821c348f3fb2513806035055e89c9bdc32fa0d4f)
- Update README with running app in Docker instructions (09e7694ff29556e2da6b165ece4dd2eed263ee6f)
Co-authored-by: Jahangir <[email protected]>
- Dockerfile +28 -0
- README.md +28 -2
- docker-compose.yml +13 -0
Dockerfile
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM --platform=arm64 python:3.10
|
2 |
+
|
3 |
+
ARG GRADIO_SERVER_PORT=7860
|
4 |
+
ARG GRADIO_SERVER_NAME="0.0.0.0"
|
5 |
+
|
6 |
+
ENV PYTHONFAULTHANDLER=1 \
|
7 |
+
PYTHONUNBUFFERED=1 \
|
8 |
+
PYTHONHASHSEED=random \
|
9 |
+
PIP_NO_CACHE_DIR=1 \
|
10 |
+
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
11 |
+
PIP_DEFAULT_TIMEOUT=100 \
|
12 |
+
GRADIO_SERVER_PORT=${GRADIO_SERVER_PORT} \
|
13 |
+
GRADIO_SERVER_NAME=${GRADIO_SERVER_NAME}
|
14 |
+
|
15 |
+
# Install Gradio dependency
|
16 |
+
RUN apt-get update && apt-get install -y ffmpeg
|
17 |
+
|
18 |
+
WORKDIR /app
|
19 |
+
COPY requirements.txt /app
|
20 |
+
|
21 |
+
# Strip out GPU packages as we will only use CPU
|
22 |
+
RUN sed -i '/nvidia\|triton/d' requirements.txt \
|
23 |
+
&& pip install -r requirements.txt
|
24 |
+
|
25 |
+
COPY . /app
|
26 |
+
|
27 |
+
EXPOSE $GRADIO_SERVER_PORT
|
28 |
+
CMD ["python", "/app/app.py"]
|
README.md
CHANGED
@@ -16,6 +16,32 @@ license: cc-by-nc-4.0
|
|
16 |
|
17 |
This is an example of using the [MERT-v1-95M](https://huggingface.co/m-a-p/MERT-v1-95M) model as backbone to conduct multiple music understanding tasks with the universal represenation.
|
18 |
|
19 |
-
The tasks include EMO, GS, MTGInstrument, MTGGenre, MTGTop50, MTGMood, NSynthI, NSynthP, VocalSetS, VocalSetT.
|
20 |
|
21 |
-
More models can be referred at the [map organization page](https://huggingface.co/m-a-p).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
This is an example of using the [MERT-v1-95M](https://huggingface.co/m-a-p/MERT-v1-95M) model as backbone to conduct multiple music understanding tasks with the universal represenation.
|
18 |
|
19 |
+
The tasks include EMO, GS, MTGInstrument, MTGGenre, MTGTop50, MTGMood, NSynthI, NSynthP, VocalSetS, VocalSetT.
|
20 |
|
21 |
+
More models can be referred at the [map organization page](https://huggingface.co/m-a-p).
|
22 |
+
|
23 |
+
# Run Local Docker
|
24 |
+
|
25 |
+
If you want to run this locally on your MacOS (M1/M2) without having to deal with installing all the dependencies yourself you can use Docker to run the app locally.
|
26 |
+
|
27 |
+
### Docker CLI
|
28 |
+
|
29 |
+
Using below commands you can build image and run container locally:
|
30 |
+
|
31 |
+
```shell
|
32 |
+
$ docker build -t isai .
|
33 |
+
$ docker run -p 7860:7860 -it isai
|
34 |
+
```
|
35 |
+
|
36 |
+
The app is now available locally at http://localhost:7860/
|
37 |
+
|
38 |
+
### Docker Compose
|
39 |
+
|
40 |
+
If there is a desire to tweak or experiment further you can also run the app using Docker Compose.
|
41 |
+
|
42 |
+
```shell
|
43 |
+
$ docker-compose build
|
44 |
+
$ docker-compose up -d
|
45 |
+
$ docker-compose exec app bash
|
46 |
+
root@cc9b8397a349:/app# python app.py
|
47 |
+
```
|
docker-compose.yml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
version: '3.5'
|
2 |
+
|
3 |
+
services:
|
4 |
+
app:
|
5 |
+
build: .
|
6 |
+
image: isai
|
7 |
+
container_name: isai
|
8 |
+
working_dir: /app
|
9 |
+
command: tail -f /dev/null # Keep container alive
|
10 |
+
ports:
|
11 |
+
- 7860:7860
|
12 |
+
volumes:
|
13 |
+
- .:/app
|