Spaces:
Paused
Paused
Download timed_objects.py from AnyaSchen/whisper-websocket: direct link, hf CLI and curl.
- Browser
- Download file 695 Bytes
-
https://huggingface.co/spaces/AnyaSchen/whisper-websocket/resolve/main/timed_objects.py
- Command line
-
hf download hf://spaces/AnyaSchen/whisper-websocket/timed_objects.py
-
curl -L -o timed_objects.py https://huggingface.co/spaces/AnyaSchen/whisper-websocket/resolve/main/timed_objects.py
695 Bytes
| from dataclasses import dataclass | |
| from typing import Optional | |
| class TimedText: | |
| start: Optional[float] | |
| end: Optional[float] | |
| text: Optional[str] = '' | |
| speaker: Optional[int] = -1 | |
| probability: Optional[float] = None | |
| is_dummy: Optional[bool] = False | |
| class ASRToken(TimedText): | |
| def with_offset(self, offset: float) -> "ASRToken": | |
| """Return a new token with the time offset added.""" | |
| return ASRToken(self.start + offset, self.end + offset, self.text, self.speaker, self.probability) | |
| class Sentence(TimedText): | |
| pass | |
| class Transcript(TimedText): | |
| pass | |
| class SpeakerSegment(TimedText): | |
| pass |