Compare commits
6 Commits
1c8a685e9e
...
v1.0.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
72a8c736e3
|
|||
|
b4fb0f217b
|
|||
|
1a5dbc65e0
|
|||
|
ea8fc74ed2
|
|||
|
c6948654a4
|
|||
|
ffefb2f09e
|
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/venv
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
FROM docker.io/nvidia/cuda:12.0.0-cudnn8-runtime-ubuntu22.04
|
FROM docker.io/nvidia/cuda:12.0.0-cudnn8-runtime-ubuntu22.04
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y ffmpeg python3 python3-pip && \
|
apt-get install -y ffmpeg python3 python3-pip git && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
|||||||
@@ -4,4 +4,5 @@ uvicorn[standard]
|
|||||||
whisper_ctranslate2
|
whisper_ctranslate2
|
||||||
opencc
|
opencc
|
||||||
prometheus-fastapi-instrumentator
|
prometheus-fastapi-instrumentator
|
||||||
|
git+https://github.com/heimoshuiyu/faster-whisper@prompt
|
||||||
pydub
|
pydub
|
||||||
|
|||||||
@@ -1,48 +1,49 @@
|
|||||||
annotated-types==0.7.0
|
annotated-types==0.7.0
|
||||||
anyio==4.4.0
|
anyio==4.4.0
|
||||||
av==12.2.0
|
av==12.3.0
|
||||||
certifi==2024.7.4
|
certifi==2024.8.30
|
||||||
cffi==1.16.0
|
cffi==1.17.1
|
||||||
charset-normalizer==3.3.2
|
charset-normalizer==3.3.2
|
||||||
click==8.1.7
|
click==8.1.7
|
||||||
coloredlogs==15.0.1
|
coloredlogs==15.0.1
|
||||||
ctranslate2==4.3.1
|
ctranslate2==4.4.0
|
||||||
fastapi==0.111.0
|
exceptiongroup==1.2.2
|
||||||
faster-whisper==1.0.3
|
fastapi==0.114.1
|
||||||
filelock==3.15.4
|
faster-whisper @ git+https://github.com/heimoshuiyu/faster-whisper@28a4d11a736d8cdeb4655ee5d7e4b4e7ae5ec8e0
|
||||||
flatbuffers==24.3.25
|
filelock==3.16.0
|
||||||
fsspec==2024.6.1
|
flatbuffers==24.3.25
|
||||||
h11==0.14.0
|
fsspec==2024.9.0
|
||||||
httptools==0.6.1
|
h11==0.14.0
|
||||||
huggingface-hub==0.23.4
|
httptools==0.6.1
|
||||||
humanfriendly==10.0
|
huggingface-hub==0.24.6
|
||||||
idna==3.7
|
humanfriendly==10.0
|
||||||
mpmath==1.3.0
|
idna==3.8
|
||||||
numpy==1.26.4
|
mpmath==1.3.0
|
||||||
onnxruntime==1.18.1
|
numpy==2.1.1
|
||||||
OpenCC==1.1.7
|
onnxruntime==1.19.2
|
||||||
packaging==24.1
|
OpenCC==1.1.9
|
||||||
prometheus-client==0.18.0
|
packaging==24.1
|
||||||
prometheus-fastapi-instrumentator==7.0.0
|
prometheus-fastapi-instrumentator==7.0.0
|
||||||
protobuf==5.27.2
|
prometheus_client==0.20.0
|
||||||
pycparser==2.22
|
protobuf==5.28.0
|
||||||
pydantic==2.8.2
|
pycparser==2.22
|
||||||
pydantic_core==2.20.1
|
pydantic==2.9.1
|
||||||
pydub==0.25.1
|
pydantic_core==2.23.3
|
||||||
python-dotenv==1.0.1
|
pydub==0.25.1
|
||||||
python-multipart==0.0.9
|
python-dotenv==1.0.1
|
||||||
PyYAML==6.0.1
|
python-multipart==0.0.9
|
||||||
requests==2.32.3
|
PyYAML==6.0.2
|
||||||
sniffio==1.3.1
|
requests==2.32.3
|
||||||
sounddevice==0.4.7
|
sniffio==1.3.1
|
||||||
starlette==0.37.2
|
sounddevice==0.5.0
|
||||||
sympy==1.12.1
|
starlette==0.38.5
|
||||||
tokenizers==0.19.1
|
sympy==1.13.2
|
||||||
tqdm==4.66.4
|
tokenizers==0.20.0
|
||||||
typing_extensions==4.12.2
|
tqdm==4.66.5
|
||||||
urllib3==2.2.2
|
typing_extensions==4.12.2
|
||||||
uvicorn==0.30.1
|
urllib3==2.2.2
|
||||||
uvloop==0.19.0
|
uvicorn==0.30.6
|
||||||
watchfiles==0.22.0
|
uvloop==0.20.0
|
||||||
websockets==12.0
|
watchfiles==0.24.0
|
||||||
whisper-ctranslate2==0.4.5
|
websockets==13.0.1
|
||||||
|
whisper-ctranslate2==0.4.5
|
||||||
|
|||||||
11
start-podman.sh
Executable file
11
start-podman.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
podman run -d --name whisper-fastapi \
|
||||||
|
--restart unless-stopped \
|
||||||
|
--name whisper-fastapi \
|
||||||
|
-v ~/.cache/huggingface:/root/.cache/huggingface \
|
||||||
|
--device nvidia.com/gpu=all --security-opt=label=disable \
|
||||||
|
--gpus all \
|
||||||
|
-p 5000:5000 \
|
||||||
|
docker.io/heimoshuiyu/whisper-fastapi:latest \
|
||||||
|
--model large-v2
|
||||||
@@ -78,7 +78,7 @@ def tsv_writer(generator: Generator[dict[str, Any], Any, None]):
|
|||||||
for i, segment in enumerate(generator):
|
for i, segment in enumerate(generator):
|
||||||
start_time = str(round(1000 * segment["start"]))
|
start_time = str(round(1000 * segment["start"]))
|
||||||
end_time = str(round(1000 * segment["end"]))
|
end_time = str(round(1000 * segment["end"]))
|
||||||
text = segment["text"]
|
text = segment["text"].strip()
|
||||||
yield f"{start_time}\t{end_time}\t{text}\n"
|
yield f"{start_time}\t{end_time}\t{text}\n"
|
||||||
|
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ def srt_writer(generator: Generator[dict[str, Any], Any, None]):
|
|||||||
end_time = format_timestamp(
|
end_time = format_timestamp(
|
||||||
segment["end"], decimal_marker=",", always_include_hours=True
|
segment["end"], decimal_marker=",", always_include_hours=True
|
||||||
)
|
)
|
||||||
text = segment["text"]
|
text = segment["text"].strip()
|
||||||
yield f"{i}\n{start_time} --> {end_time}\n{text}\n\n"
|
yield f"{i}\n{start_time} --> {end_time}\n{text}\n\n"
|
||||||
|
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ def vtt_writer(generator: Generator[dict[str, Any], Any, None]):
|
|||||||
for i, segment in enumerate(generator):
|
for i, segment in enumerate(generator):
|
||||||
start_time = format_timestamp(segment["start"])
|
start_time = format_timestamp(segment["start"])
|
||||||
end_time = format_timestamp(segment["end"])
|
end_time = format_timestamp(segment["end"])
|
||||||
text = segment["text"]
|
text = segment["text"].strip()
|
||||||
yield f"{start_time} --> {end_time}\n{text}\n\n"
|
yield f"{start_time} --> {end_time}\n{text}\n\n"
|
||||||
|
|
||||||
|
|
||||||
@@ -159,6 +159,8 @@ def stream_builder(
|
|||||||
|
|
||||||
@app.websocket("/k6nele/status")
|
@app.websocket("/k6nele/status")
|
||||||
@app.websocket("/konele/status")
|
@app.websocket("/konele/status")
|
||||||
|
@app.websocket("/v1/k6nele/status")
|
||||||
|
@app.websocket("/v1/konele/status")
|
||||||
async def konele_status(
|
async def konele_status(
|
||||||
websocket: WebSocket,
|
websocket: WebSocket,
|
||||||
):
|
):
|
||||||
@@ -169,6 +171,8 @@ async def konele_status(
|
|||||||
|
|
||||||
@app.websocket("/k6nele/ws")
|
@app.websocket("/k6nele/ws")
|
||||||
@app.websocket("/konele/ws")
|
@app.websocket("/konele/ws")
|
||||||
|
@app.websocket("/v1/k6nele/ws")
|
||||||
|
@app.websocket("/v1/konele/ws")
|
||||||
async def konele_ws(
|
async def konele_ws(
|
||||||
websocket: WebSocket,
|
websocket: WebSocket,
|
||||||
task: Literal["transcribe", "translate"] = "transcribe",
|
task: Literal["transcribe", "translate"] = "transcribe",
|
||||||
@@ -233,6 +237,8 @@ async def konele_ws(
|
|||||||
|
|
||||||
@app.post("/k6nele/post")
|
@app.post("/k6nele/post")
|
||||||
@app.post("/konele/post")
|
@app.post("/konele/post")
|
||||||
|
@app.post("/v1/k6nele/post")
|
||||||
|
@app.post("/v1/konele/post")
|
||||||
async def translateapi(
|
async def translateapi(
|
||||||
request: Request,
|
request: Request,
|
||||||
task: Literal["transcribe", "translate"] = "transcribe",
|
task: Literal["transcribe", "translate"] = "transcribe",
|
||||||
|
|||||||
Reference in New Issue
Block a user