fixed reference before assignment error/warning
This commit is contained in:
@@ -5,7 +5,7 @@ import json
|
|||||||
import functools
|
import functools
|
||||||
import logging
|
import logging
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import List
|
from typing import List, Optional
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@@ -156,6 +156,8 @@ class TranscriptionServer:
|
|||||||
self, websocket, options, faster_whisper_custom_model_path,
|
self, websocket, options, faster_whisper_custom_model_path,
|
||||||
whisper_tensorrt_path, trt_multilingual
|
whisper_tensorrt_path, trt_multilingual
|
||||||
):
|
):
|
||||||
|
client: Optional[ServeClientBase] = None
|
||||||
|
|
||||||
if self.backend == "tensorrt":
|
if self.backend == "tensorrt":
|
||||||
try:
|
try:
|
||||||
client = ServeClientTensorRT(
|
client = ServeClientTensorRT(
|
||||||
@@ -196,6 +198,9 @@ class TranscriptionServer:
|
|||||||
)
|
)
|
||||||
logging.info("Running faster_whisper backend.")
|
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)
|
self.client_manager.add_client(websocket, client)
|
||||||
|
|
||||||
def get_audio_from_websocket(self, websocket):
|
def get_audio_from_websocket(self, websocket):
|
||||||
|
|||||||
Reference in New Issue
Block a user