fix some linting
This commit is contained in:
@@ -55,13 +55,7 @@ class AudioRawFrame(DataFrame):
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
pts = format_pts(self.pts)
|
pts = format_pts(self.pts)
|
||||||
return f"{
|
return f"{self.name}(pts: {pts}, size: {len(self.audio)}, frames: {self.num_frames}, sample_rate: {self.sample_rate}, channels: {self.num_channels})"
|
||||||
self.name}(pts: {pts}, size: {
|
|
||||||
len(
|
|
||||||
self.audio)}, frames: {
|
|
||||||
self.num_frames}, sample_rate: {
|
|
||||||
self.sample_rate}, channels: {
|
|
||||||
self.num_channels})"
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -102,11 +96,7 @@ class VisionImageRawFrame(ImageRawFrame):
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
pts = format_pts(self.pts)
|
pts = format_pts(self.pts)
|
||||||
return f"{
|
return f"{self.name}(pts: {pts}, text: {self.text}, size: {self.size}, format: {self.format})"
|
||||||
self.name}(pts: {pts}, text: {
|
|
||||||
self.text}, size: {
|
|
||||||
self.size}, format: {
|
|
||||||
self.format})"
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -119,11 +109,7 @@ class UserImageRawFrame(ImageRawFrame):
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
pts = format_pts(self.pts)
|
pts = format_pts(self.pts)
|
||||||
return f"{
|
return f"{self.name}(pts: {pts}, user: {self.user_id}, size: {self.size}, format: {self.format})"
|
||||||
self.name}(pts: {pts}, user: {
|
|
||||||
self.user_id}, size: {
|
|
||||||
self.size}, format: {
|
|
||||||
self.format})"
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -164,12 +150,7 @@ class TranscriptionFrame(TextFrame):
|
|||||||
language: Language | None = None
|
language: Language | None = None
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{
|
return f"{self.name}(user: {self.user_id}, text: {self.text}, language: {self.language}, timestamp: {self.timestamp})"
|
||||||
self.name}(user: {
|
|
||||||
self.user_id}, text: {
|
|
||||||
self.text}, language: {
|
|
||||||
self.language}, timestamp: {
|
|
||||||
self.timestamp})"
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -181,12 +162,7 @@ class InterimTranscriptionFrame(TextFrame):
|
|||||||
language: Language | None = None
|
language: Language | None = None
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{
|
return f"{self.name}(user: {self.user_id}, text: {self.text}, language: {self.language}, timestamp: {self.timestamp})"
|
||||||
self.name}(user: {
|
|
||||||
self.user_id}, text: {
|
|
||||||
self.text}, language: {
|
|
||||||
self.language}, timestamp: {
|
|
||||||
self.timestamp})"
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@@ -70,10 +70,7 @@ class FrameProcessorMetrics:
|
|||||||
|
|
||||||
async def start_llm_usage_metrics(self, tokens: dict):
|
async def start_llm_usage_metrics(self, tokens: dict):
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"{
|
f"{self._name} prompt tokens: {tokens['prompt_tokens']}, completion tokens: {tokens['completion_tokens']}")
|
||||||
self._name} prompt tokens: {
|
|
||||||
tokens['prompt_tokens']}, completion tokens: {
|
|
||||||
tokens['completion_tokens']}")
|
|
||||||
return MetricsFrame(tokens=[tokens])
|
return MetricsFrame(tokens=[tokens])
|
||||||
|
|
||||||
async def start_tts_usage_metrics(self, text: str):
|
async def start_tts_usage_metrics(self, text: str):
|
||||||
|
|||||||
@@ -58,8 +58,6 @@ def calculate_word_times(
|
|||||||
alignment_info["charDurationsMs"])]
|
alignment_info["charDurationsMs"])]
|
||||||
zipped_end_times = list(zip(alignment_info["chars"], end_times))
|
zipped_end_times = list(zip(alignment_info["chars"], end_times))
|
||||||
|
|
||||||
# Get the start time of every character that appears after a space and
|
|
||||||
# match this to the word
|
|
||||||
words = "".join(alignment_info["chars"]).split(" ")
|
words = "".join(alignment_info["chars"]).split(" ")
|
||||||
|
|
||||||
# Calculate end time for each word. We do this by finding a space character
|
# Calculate end time for each word. We do this by finding a space character
|
||||||
@@ -169,8 +167,7 @@ class ElevenLabsTTSService(AsyncWordTTSService):
|
|||||||
voice_id = self._voice_id
|
voice_id = self._voice_id
|
||||||
model = self._model
|
model = self._model
|
||||||
output_format = self._params.output_format
|
output_format = self._params.output_format
|
||||||
url = f"{
|
url = f"{self._url}/v1/text-to-speech/{voice_id}/stream-input?model_id={model}&output_format={output_format}"
|
||||||
self._url}/v1/text-to-speech/{voice_id}/stream-input?model_id={model}&output_format={output_format}"
|
|
||||||
self._websocket = await websockets.connect(url)
|
self._websocket = await websockets.connect(url)
|
||||||
self._receive_task = self.get_event_loop().create_task(self._receive_task_handler())
|
self._receive_task = self.get_event_loop().create_task(self._receive_task_handler())
|
||||||
self._keepalive_task = self.get_event_loop().create_task(self._keepalive_task_handler())
|
self._keepalive_task = self.get_event_loop().create_task(self._keepalive_task_handler())
|
||||||
|
|||||||
Reference in New Issue
Block a user