Compare commits
2 Commits
f71ef945db
...
ed1e51fefa
| Author | SHA1 | Date | |
|---|---|---|---|
|
ed1e51fefa
|
|||
|
042800721d
|
19
Dockerfile
Normal file
19
Dockerfile
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
FROM docker.io/nvidia/cuda:12.0.0-cudnn8-runtime-ubuntu22.04
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y ffmpeg python3 python3-pip && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY requirements.txt .
|
||||||
|
|
||||||
|
RUN pip3 install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
EXPOSE 5000
|
||||||
|
|
||||||
|
# 启动 whisper_fastapi.py
|
||||||
|
ENTRYPOINT ["python3", "whisper_fastapi.py"]
|
||||||
10
start-docker.sh
Executable file
10
start-docker.sh
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
docker run -d --name whisper-fastapi \
|
||||||
|
--restart unless-stopped \
|
||||||
|
--name whisper-fastapi \
|
||||||
|
-v ~/.cache/huggingface:/root/.cache/huggingface \
|
||||||
|
--gpus all \
|
||||||
|
-p 5000:5000 \
|
||||||
|
docker.io/heimoshuiyu/whisper-fastapi:lastet \
|
||||||
|
--model large-v2
|
||||||
@@ -39,7 +39,7 @@ app = FastAPI()
|
|||||||
Instrumentator().instrument(app).expose(app, endpoint="/konele/metrics")
|
Instrumentator().instrument(app).expose(app, endpoint="/konele/metrics")
|
||||||
ccc = opencc.OpenCC("t2s.json")
|
ccc = opencc.OpenCC("t2s.json")
|
||||||
|
|
||||||
print("Loading model...")
|
print(f"Loading model to device {args.device}...")
|
||||||
transcriber = Transcribe(
|
transcriber = Transcribe(
|
||||||
model_path=args.model,
|
model_path=args.model,
|
||||||
device=args.device,
|
device=args.device,
|
||||||
@@ -49,7 +49,7 @@ transcriber = Transcribe(
|
|||||||
cache_directory=args.cache_dir,
|
cache_directory=args.cache_dir,
|
||||||
local_files_only=args.local_files_only,
|
local_files_only=args.local_files_only,
|
||||||
)
|
)
|
||||||
print("Model loaded!")
|
print(f"Model loaded to device {transcriber.model.model.device}")
|
||||||
|
|
||||||
|
|
||||||
# allow all cors
|
# allow all cors
|
||||||
|
|||||||
Reference in New Issue
Block a user