MH0386 commited on
Commit
f143e30
·
verified ·
1 Parent(s): ef31074

Upload folder using huggingface_hub

Browse files
Files changed (6) hide show
  1. .gitattributes +5 -5
  2. .gitignore +2 -0
  3. Dockerfile +34 -28
  4. compose.yml +12 -0
  5. pyproject.toml +4 -4
  6. src/vocalizr/__init__.py +1 -1
.gitattributes CHANGED
@@ -92,11 +92,11 @@
92
  *.ps1 text eol=crlf
93
 
94
  # Serialisation
95
- *.json text
96
- *.toml text
97
- *.xml text
98
- *.yaml text
99
- *.yml text
100
 
101
  # Archives
102
  *.7z binary
 
92
  *.ps1 text eol=crlf
93
 
94
  # Serialisation
95
+ *.json text eol=lf
96
+ *.toml text eol=lf
97
+ *.xml text eol=lf
98
+ *.yaml text eol=lf
99
+ *.yml text eol=lf
100
 
101
  # Archives
102
  *.7z binary
.gitignore CHANGED
@@ -5,6 +5,8 @@
5
  .venv/
6
  logs/
7
  results/
 
 
8
  .github/
9
  .idea/
10
  renovate.json
 
5
  .venv/
6
  logs/
7
  results/
8
+ .trunk
9
+ pylock.toml
10
  .github/
11
  .idea/
12
  renovate.json
Dockerfile CHANGED
@@ -1,40 +1,46 @@
1
- # trunk-ignore-all(checkov/CKV_DOCKER_2)
2
- FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
3
-
4
- ENV UV_COMPILE_BYTECODE=1 \
5
- UV_NO_CACHE=1 \
6
- UV_SYSTEM_PYTHON=1 \
7
- UV_FROZEN=1 \
8
- PATH="/root/.local/bin:$PATH" \
9
- GRADIO_SERVER_PORT=7860 \
10
- GRADIO_SERVER_NAME=0.0.0.0
11
 
12
- # trunk-ignore(hadolint/DL3008)
13
- RUN groupadd vocalizr && \
14
- useradd -g vocalizr -s /bin/bash -d /app vocalizr && \
15
- apt-get update -qq && \
16
- apt-get install -qq -y --no-install-recommends espeak-ng ffmpeg && \
17
- apt-get clean -qq && \
18
- rm -rf /var/lib/apt/lists/* && \
19
- uv tool install --quiet huggingface-hub[cli] && \
20
- huggingface-cli download --quiet hexgrad/Kokoro-82M && \
21
- uv tool uninstall --quiet huggingface-hub
22
 
23
  WORKDIR /app
24
 
25
- RUN --mount=type=bind,source=uv.lock,target=uv.lock \
 
26
  --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
27
  --mount=type=bind,source=README.md,target=README.md \
28
- --mount=type=bind,source=src,target=/app/src \
29
- uv export --no-hashes --no-editable --no-dev --quiet -o pylock.toml && \
30
- uv pip sync pylock.toml
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
- RUN chown -R vocalizr:vocalizr /app
33
 
34
- COPY --chown=vocalizr:vocalizr . /app
35
 
36
- USER vocalizr
37
 
38
  EXPOSE ${GRADIO_SERVER_PORT}
39
 
40
- CMD ["python", "src/vocalizr"]
 
1
+ FROM python:3.12 AS builder
 
 
 
 
 
 
 
 
 
2
 
3
+ SHELL ["/bin/bash", "-c"]
4
+
5
+ ENV UV_LINK_MODE=copy \
6
+ UV_COMPILE_BYTECODE=1 \
7
+ UV_PYTHON_DOWNLOADS=0
8
+
9
+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
 
 
 
10
 
11
  WORKDIR /app
12
 
13
+ RUN --mount=type=cache,target=/root/.cache/uv \
14
+ --mount=type=bind,source=uv.lock,target=uv.lock \
15
  --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
16
  --mount=type=bind,source=README.md,target=README.md \
17
+ uv sync --no-install-project --no-dev --locked --no-editable
18
+
19
+ COPY . /app
20
+
21
+ RUN --mount=type=cache,target=/root/.cache/uv \
22
+ uv sync --no-dev --locked --no-editable
23
+
24
+ FROM python:3.12-slim AS production
25
+
26
+ SHELL ["/bin/bash", "-c"]
27
+
28
+ ENV GRADIO_SERVER_PORT=7860 \
29
+ GRADIO_SERVER_NAME=0.0.0.0
30
+
31
+ RUN groupadd app && \
32
+ useradd -m -g app -s /bin/bash app && \
33
+ apt-get update -qq && \
34
+ apt-get install -qq -y --no-install-recommends espeak-ng ffmpeg && \
35
+ apt-get clean -qq && \
36
+ rm -rf /var/lib/apt/lists/*
37
 
38
+ WORKDIR /home/app
39
 
40
+ COPY --from=builder --chown=app:app /app/.venv /app/.venv
41
 
42
+ USER app
43
 
44
  EXPOSE ${GRADIO_SERVER_PORT}
45
 
46
+ CMD ["/app/.venv/bin/vocalizr"]
compose.yml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ vocalizr:
3
+ image: ghcr.io/alphaspheredotai/vocalizr:multistage
4
+ ports:
5
+ - "7860:7860"
6
+ volumes:
7
+ - virtualenv:/venv
8
+ environment:
9
+ - GRADIO_SERVER_PORT=7860
10
+ - GRADIO_SERVER_NAME=0.0.0.0
11
+ volumes:
12
+ virtualenv:
pyproject.toml CHANGED
@@ -3,10 +3,10 @@ name = "vocalizr"
3
  version = "0.0.1"
4
  description = "Voice Generator part of the Chatacter Backend"
5
  readme = "README.md"
6
- requires-python = ">=3.12"
7
  dependencies = [
8
  "en-core-web-sm",
9
- "gradio[mcp]>=5.31.0",
10
  "kokoro>=0.9.4",
11
  "soundfile>=0.13.1",
12
  ]
@@ -21,8 +21,8 @@ build-backend = "uv_build"
21
  [dependency-groups]
22
  dev = [
23
  "watchfiles>=1.0.5",
24
- "ruff>=0.11.11",
25
- "huggingface-hub[cli,hf-transfer]>=0.31.4",
26
  "ty>=0.0.1a6",
27
  ]
28
 
 
3
  version = "0.0.1"
4
  description = "Voice Generator part of the Chatacter Backend"
5
  readme = "README.md"
6
+ requires-python = ">=3.12, <3.13"
7
  dependencies = [
8
  "en-core-web-sm",
9
+ "gradio[mcp]>=5.32.0",
10
  "kokoro>=0.9.4",
11
  "soundfile>=0.13.1",
12
  ]
 
21
  [dependency-groups]
22
  dev = [
23
  "watchfiles>=1.0.5",
24
+ "ruff>=0.11.12",
25
+ "huggingface-hub[cli,hf-transfer]>=0.32.3",
26
  "ty>=0.0.1a6",
27
  ]
28
 
src/vocalizr/__init__.py CHANGED
@@ -36,7 +36,7 @@
36
 
37
  CUDA_AVAILABLE: bool = cuda.is_available()
38
  logger.add(
39
- LOG_FILE_PATH,
40
  format="{time:YYYY-MM-DD at HH:mm:ss} | {level} | {message}",
41
  colorize=True,
42
  )
 
36
 
37
  CUDA_AVAILABLE: bool = cuda.is_available()
38
  logger.add(
39
+ sink=LOG_FILE_PATH,
40
  format="{time:YYYY-MM-DD at HH:mm:ss} | {level} | {message}",
41
  colorize=True,
42
  )