fixed reference before assignment error/warning

This commit is contained in:
berkaybilik
2024-06-27 00:11:06 +01:00
parent 5e3906fc7b
commit b220ccb330
+6 -1
View File
@@ -5,7 +5,7 @@ import json
import functools
import logging
from enum import Enum
from typing import List
from typing import List, Optional
import torch
import numpy as np
@@ -156,6 +156,8 @@ class TranscriptionServer:
self, websocket, options, faster_whisper_custom_model_path,
whisper_tensorrt_path, trt_multilingual
):
client: Optional[ServeClientBase] = None
if self.backend == "tensorrt":
try:
client = ServeClientTensorRT(
@@ -196,6 +198,9 @@ class TranscriptionServer:
)
logging.info("Running faster_whisper backend.")
if client is None:
raise ValueError(f"Backend type {self.backend} not recognised or not handled.")
self.client_manager.add_client(websocket, client)
def get_audio_from_websocket(self, websocket):