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
1def55cf
Unverified
Commit
1def55cf
authored
Feb 15, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Feb 15, 2024
Browse files
Merge pull request #725 from jnkstr/no-internet-whisper
fix: no internet connection for whisper if you use docker
parents
c0b5e66d
63e6f39b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
5 deletions
+13
-5
Dockerfile
Dockerfile
+6
-0
backend/apps/audio/main.py
backend/apps/audio/main.py
+4
-4
backend/config.py
backend/config.py
+3
-1
No files found.
Dockerfile
View file @
1def55cf
...
...
@@ -30,6 +30,10 @@ ENV WEBUI_SECRET_KEY ""
ENV
SCARF_NO_ANALYTICS true
ENV
DO_NOT_TRACK true
#Whisper TTS Settings
ENV
WHISPER_MODEL="base"
ENV
WHISPER_MODEL_DIR="/app/backend/data/cache/whisper/models"
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_MODEL_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 @
1def55cf
import
os
from
fastapi
import
(
FastAPI
,
Request
,
...
...
@@ -20,7 +21,7 @@ from utils.utils import (
)
from
utils.misc
import
calculate_sha256
from
config
import
CACHE_DIR
,
UPLOAD_DIR
,
WHISPER_MODEL
_NAME
from
config
import
CACHE_DIR
,
UPLOAD_DIR
,
WHISPER_MODEL
,
WHISPER_MODEL_DIR
app
=
FastAPI
()
app
.
add_middleware
(
...
...
@@ -53,12 +54,11 @@ def transcribe(
f
.
write
(
contents
)
f
.
close
()
model_name
=
WHISPER_MODEL_NAME
model
=
WhisperModel
(
model_name
,
WHISPER_MODEL
,
device
=
"cpu"
,
compute_type
=
"int8"
,
download_root
=
f
"
{
CACHE_DIR
}
/whisper/models"
,
download_root
=
WHISPER_MODEL_DIR
,
)
segments
,
info
=
model
.
transcribe
(
file_path
,
beam_size
=
5
)
...
...
backend/config.py
View file @
1def55cf
...
...
@@ -139,4 +139,6 @@ CHUNK_OVERLAP = 100
####################################
# Transcribe
####################################
WHISPER_MODEL_NAME
=
"base"
WHISPER_MODEL
=
os
.
getenv
(
"WHISPER_MODEL"
,
"base"
)
WHISPER_MODEL_DIR
=
os
.
getenv
(
"WHISPER_MODEL_DIR"
,
f
"
{
CACHE_DIR
}
/whisper/models"
)
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