• Y
  • List All
  • Feedback
    • This Project
    • All Projects
Profile Account settings Log out
  • Favorite
  • Project
  • All
Loading...
  • Log in
  • Sign up
yjyoon / whisper_server_speaches star
  • Project homeH
  • CodeC
  • IssueI
  • Pull requestP
  • Review R
  • MilestoneM
  • BoardB
  • Files
  • Commit
  • Branches
whisper_server_speachesfaster_whisper_servertranscriber.py
Download as .zip file
File name
Commit message
Commit date
.github/workflows
ci: add test action
2024-07-03
examples
Update script.sh
2024-09-03
faster_whisper_server
feat: ollama-like ps endpoints
2024-09-05
scripts
chore: minor changes to scripts/client.py
2024-09-05
tests
feat: handle srt and vtt response formats
2024-07-20
.dockerignore
chore: ignore .env
2024-05-27
.envrc
init
2024-05-20
.gitattributes
docs: add live-transcription demo
2024-05-28
.gitignore
chore: update .gitignore
2024-07-03
.pre-commit-config.yaml
switch to basedpyright
2024-07-20
Dockerfile.cpu
fix task enum vals, fix env var parsing, improve gradio, use uv in dockerfile
2024-06-23
Dockerfile.cuda
fix task enum vals, fix env var parsing, improve gradio, use uv in dockerfile
2024-06-23
LICENSE
init
2024-05-20
README.md
add tutorial for kubernetes
2024-09-04
Taskfile.yaml
chore: remove `lsyncd`
2024-09-05
audio.wav
docs: update README.md
2024-05-27
compose.yaml
chore: update docker tag to latest
2024-06-03
flake.lock
deps: update flake
2024-09-08
flake.nix
deps: update flake
2024-09-08
overrides.txt
deps: update
2024-07-16
pyproject.toml
deps: remove `other`
2024-09-08
requirements-all.txt
deps: remove `other`
2024-09-08
requirements-dev.txt
deps: remove `other`
2024-09-08
requirements.txt
deps: remove `other`
2024-09-08
File name
Commit message
Commit date
__init__.py
chore: rename to 'faster-whisper-server'
2024-05-27
asr.py
refactor
2024-07-20
audio.py
fix: Correct closing logic in AudioStream to prevent discarding remaining data
2024-07-17
config.py
feat: support model preloading (#66)
2024-09-05
core.py
chore: add a more descriptive assert error message (#58)
2024-08-27
gradio_app.py
refactor
2024-07-20
logger.py
chore: fix ruff errors
2024-07-03
main.py
feat: ollama-like ps endpoints
2024-09-05
server_models.py
refactor
2024-07-20
transcriber.py
refactor
2024-07-20
Fedir Zadniprovskyi 2024-07-20 4a548b6 refactor UNIX
Raw Open in browser Change history
from __future__ import annotations from typing import TYPE_CHECKING from faster_whisper_server.audio import Audio, AudioStream from faster_whisper_server.config import config from faster_whisper_server.core import Transcription, Word, common_prefix, to_full_sentences, word_to_text from faster_whisper_server.logger import logger if TYPE_CHECKING: from collections.abc import AsyncGenerator from faster_whisper_server.asr import FasterWhisperASR class LocalAgreement: def __init__(self) -> None: self.unconfirmed = Transcription() def merge(self, confirmed: Transcription, incoming: Transcription) -> list[Word]: # https://github.com/ufal/whisper_streaming/blob/main/whisper_online.py#L264 incoming = incoming.after(confirmed.end - 0.1) prefix = common_prefix(incoming.words, self.unconfirmed.words) logger.debug(f"Confirmed: {confirmed.text}") logger.debug(f"Unconfirmed: {self.unconfirmed.text}") logger.debug(f"Incoming: {incoming.text}") if len(incoming.words) > len(prefix): self.unconfirmed = Transcription(incoming.words[len(prefix) :]) else: self.unconfirmed = Transcription() return prefix # TODO: needs a better name def needs_audio_after(confirmed: Transcription) -> float: full_sentences = to_full_sentences(confirmed.words) return full_sentences[-1][-1].end if len(full_sentences) > 0 else 0.0 def prompt(confirmed: Transcription) -> str | None: sentences = to_full_sentences(confirmed.words) return word_to_text(sentences[-1]) if len(sentences) > 0 else None async def audio_transcriber( asr: FasterWhisperASR, audio_stream: AudioStream, ) -> AsyncGenerator[Transcription, None]: local_agreement = LocalAgreement() full_audio = Audio() confirmed = Transcription() async for chunk in audio_stream.chunks(config.min_duration): full_audio.extend(chunk) audio = full_audio.after(needs_audio_after(confirmed)) transcription, _ = await asr.transcribe(audio, prompt(confirmed)) new_words = local_agreement.merge(confirmed, transcription) if len(new_words) > 0: confirmed.extend(new_words) yield confirmed logger.debug("Flushing...") confirmed.extend(local_agreement.unconfirmed.words) yield confirmed logger.info("Audio transcriber finished")

          
        
    
    
Copyright Yona authors & © NAVER Corp. & NAVER LABS Supported by NAVER CLOUD PLATFORM

or
Sign in with github login with Google Sign in with Google
Reset password | Sign up