Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
8ab0338e
"torchvision/vscode:/vscode.git/clone" did not exist on "d805aeaee7651ffb22a98647683605ae5f5c6c1a"
Commit
8ab0338e
authored
Feb 13, 2024
by
Jannik Streidl
Browse files
no internet connection for whisper if you use docker
parent
a8a0ebf3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
Dockerfile
Dockerfile
+6
-0
backend/apps/audio/main.py
backend/apps/audio/main.py
+5
-2
No files found.
Dockerfile
View file @
8ab0338e
...
...
@@ -30,6 +30,10 @@ ENV WEBUI_SECRET_KEY ""
ENV
SCARF_NO_ANALYTICS true
ENV
DO_NOT_TRACK true
#Whisper TTS Settings
ENV
WHISPER_DIR="/app/backend/data/cache/whisper/models"
ENV
WHISPER_MODEL="base"
WORKDIR
/app/backend
# install python dependencies
...
...
@@ -45,6 +49,8 @@ RUN apt-get update \
&&
rm
-rf
/var/lib/apt/lists/
*
# RUN python -c "from sentence_transformers import SentenceTransformer; model = SentenceTransformer('all-MiniLM-L6-v2')"
RUN
python
-c
"import os; from faster_whisper import WhisperModel; WhisperModel(os.environ['WHISPER_MODEL'], device='cpu', compute_type='int8', download_root=os.environ['WHISPER_DIR'])"
# copy embedding weight from build
RUN
mkdir
-p
/root/.cache/chroma/onnx_models/all-MiniLM-L6-v2
...
...
backend/apps/audio/main.py
View file @
8ab0338e
import
os
from
fastapi
import
(
FastAPI
,
Request
,
...
...
@@ -53,12 +54,14 @@ def transcribe(
f
.
write
(
contents
)
f
.
close
()
model_name
=
WHISPER_MODEL_NAME
model_name
=
os
.
getenv
(
'WHISPER_MODEL'
,
WHISPER_MODEL_NAME
)
download_root
=
os
.
getenv
(
'WHISPER_DIR'
,
f
"
{
CACHE_DIR
}
/whisper/models"
)
model
=
WhisperModel
(
model_name
,
device
=
"cpu"
,
compute_type
=
"int8"
,
download_root
=
f
"
{
CACHE_DIR
}
/whisper/models"
,
download_root
=
download_root
,
)
segments
,
info
=
model
.
transcribe
(
file_path
,
beam_size
=
5
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment