• 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_serverserver_models.py
Download as .zip file
File name
Commit message
Commit date
.github/workflows
update pre-commit deps, replace custom pyright hook
2024-07-03
examples
chore: update docker tag to latest
2024-06-03
faster_whisper_server
chore: fix ruff errors
2024-07-03
tests
chore: fix ruff errors
2024-07-03
.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
update pre-commit deps, replace custom pyright hook
2024-07-03
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
Update README.md
2024-06-26
Taskfile.yaml
switch to using uv
2024-07-03
audio.wav
docs: update README.md
2024-05-27
compose.yaml
chore: update docker tag to latest
2024-06-03
flake.lock
init
2024-05-20
flake.nix
switch to using uv
2024-07-03
lsyncd.conf
chore: add lsyncd config
2024-06-03
pyproject.toml
chore: fix ruff errors
2024-07-03
requirements-all.txt
switch to using uv
2024-07-03
requirements-dev.txt
switch to using uv
2024-07-03
requirements.txt
switch to using uv
2024-07-03
File name
Commit message
Commit date
__init__.py
chore: rename to 'faster-whisper-server'
2024-05-27
asr.py
chore: fix ruff errors
2024-07-03
audio.py
chore: fix ruff errors
2024-07-03
config.py
chore: fix ruff errors
2024-07-03
core.py
chore: fix ruff errors
2024-07-03
gradio_app.py
chore: fix ruff errors
2024-07-03
logger.py
chore: fix ruff errors
2024-07-03
main.py
chore: fix ruff errors
2024-07-03
server_models.py
chore: fix ruff errors
2024-07-03
transcriber.py
chore: fix ruff errors
2024-07-03
utils.py
chore: rename to 'faster-whisper-server'
2024-05-27
Fedir Zadniprovskyi 2024-07-03 88f0467 chore: fix ruff errors UNIX
Raw Open in browser Change history
from __future__ import annotations from typing import TYPE_CHECKING, Literal from pydantic import BaseModel, ConfigDict, Field from faster_whisper_server import utils if TYPE_CHECKING: from faster_whisper.transcribe import Segment, TranscriptionInfo, Word from faster_whisper_server.core import Transcription # https://platform.openai.com/docs/api-reference/audio/json-object class TranscriptionJsonResponse(BaseModel): text: str @classmethod def from_segments(cls, segments: list[Segment]) -> TranscriptionJsonResponse: return cls(text=utils.segments_text(segments)) @classmethod def from_transcription(cls, transcription: Transcription) -> TranscriptionJsonResponse: return cls(text=transcription.text) class WordObject(BaseModel): start: float end: float word: str probability: float @classmethod def from_word(cls, word: Word) -> WordObject: return cls( start=word.start, end=word.end, word=word.word, probability=word.probability, ) class SegmentObject(BaseModel): id: int seek: int start: float end: float text: str tokens: list[int] temperature: float avg_logprob: float compression_ratio: float no_speech_prob: float @classmethod def from_segment(cls, segment: Segment) -> SegmentObject: return cls( id=segment.id, seek=segment.seek, start=segment.start, end=segment.end, text=segment.text, tokens=segment.tokens, temperature=segment.temperature, avg_logprob=segment.avg_logprob, compression_ratio=segment.compression_ratio, no_speech_prob=segment.no_speech_prob, ) # https://platform.openai.com/docs/api-reference/audio/verbose-json-object class TranscriptionVerboseJsonResponse(BaseModel): task: str = "transcribe" language: str duration: float text: str words: list[WordObject] segments: list[SegmentObject] @classmethod def from_segment(cls, segment: Segment, transcription_info: TranscriptionInfo) -> TranscriptionVerboseJsonResponse: return cls( language=transcription_info.language, duration=segment.end - segment.start, text=segment.text, words=([WordObject.from_word(word) for word in segment.words] if isinstance(segment.words, list) else []), segments=[SegmentObject.from_segment(segment)], ) @classmethod def from_segments( cls, segments: list[Segment], transcription_info: TranscriptionInfo ) -> TranscriptionVerboseJsonResponse: return cls( language=transcription_info.language, duration=transcription_info.duration, text=utils.segments_text(segments), segments=[SegmentObject.from_segment(segment) for segment in segments], words=[WordObject.from_word(word) for word in utils.words_from_segments(segments)], ) @classmethod def from_transcription(cls, transcription: Transcription) -> TranscriptionVerboseJsonResponse: return cls( language="english", # FIX: hardcoded duration=transcription.duration, text=transcription.text, words=[ WordObject( start=word.start, end=word.end, word=word.text, probability=word.probability, ) for word in transcription.words ], segments=[], # FIX: hardcoded ) class ModelObject(BaseModel): id: str """The model identifier, which can be referenced in the API endpoints.""" created: int """The Unix timestamp (in seconds) when the model was created.""" object_: Literal["model"] = Field(serialization_alias="object") """The object type, which is always "model".""" owned_by: str """The organization that owns the model.""" model_config = ConfigDict( populate_by_name=True, json_schema_extra={ "examples": [ { "id": "Systran/faster-whisper-large-v3", "created": 1700732060, "object": "model", "owned_by": "Systran", }, { "id": "Systran/faster-distil-whisper-large-v3", "created": 1711378296, "object": "model", "owned_by": "Systran", }, { "id": "bofenghuang/whisper-large-v2-cv11-french-ct2", "created": 1687968011, "object": "model", "owned_by": "bofenghuang", }, ] }, )

          
        
    
    
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