Remove multilingual from client. Remove multilingual from faster whisper backend. Disable task dropdown when capturing in chrome extension.

This commit is contained in:
Sasa Trivic
2024-02-02 13:56:26 +01:00
parent b098b52a4d
commit e697574870
3 changed files with 6 additions and 15 deletions
+1 -1
View File
@@ -120,7 +120,7 @@ document.addEventListener("DOMContentLoaded", function () {
stopButton.disabled = !isCapturing;
useServerCheckbox.disabled = isCapturing;
modelSizeDropdown.disabled = isCapturing;
taskDropdown.disabled = isCapturing;
startButton.classList.toggle("disabled", isCapturing);
stopButton.classList.toggle("disabled", !isCapturing);
}
+5 -11
View File
@@ -76,7 +76,6 @@ class Client:
self,
host=None,
port=None,
is_multilingual=False,
lang=None,
translate=False,
model="small",
@@ -92,8 +91,7 @@ class Client:
Args:
host (str): The hostname or IP address of the server.
port (int): The port number for the WebSocket server.
is_multilingual (bool, optional): Specifies if multilingual transcription is enabled. Default is False.
lang (str, optional): The selected language for transcription when multilingual is disabled. Default is None.
lang (str, optional): The selected language for transcription. Default is None.
translate (bool, optional): Specifies if the task is translation. Default is False.
"""
self.chunk = 4096
@@ -107,7 +105,6 @@ class Client:
self.waiting = False
self.last_response_recieved = None
self.disconnect_if_no_response_for = 15
self.multilingual = is_multilingual
self.language = lang
self.model = model
self.server_error = False
@@ -245,7 +242,7 @@ class Client:
"""
Callback function called when the WebSocket connection is successfully opened.
Sends an initial configuration message to the server, including client UID, multilingual mode,
Sends an initial configuration message to the server, including client UID,
language selection, and task type.
Args:
@@ -259,7 +256,6 @@ class Client:
json.dumps(
{
"uid": self.uid,
"multilingual": self.multilingual,
"language": self.language,
"task": self.task,
"model": self.model,
@@ -546,8 +542,7 @@ class TranscriptionClient:
Args:
host (str): The hostname or IP address of the server.
port (int): The port number to connect to on the server.
is_multilingual (bool, optional): Indicates whether the transcription should support multiple languages (default is False).
lang (str, optional): The primary language for transcription (used if `is_multilingual` is False). Default is None, which defaults to English ('en').
lang (str, optional): The primary language for transcription. Default is None, which defaults to English ('en').
translate (bool, optional): Indicates whether translation tasks are required (default is False).
Attributes:
@@ -556,19 +551,18 @@ class TranscriptionClient:
Example:
To create a TranscriptionClient and start transcription on microphone audio:
```python
transcription_client = TranscriptionClient(host="localhost", port=9090, is_multilingual=True)
transcription_client = TranscriptionClient(host="localhost", port=9090)
transcription_client()
```
"""
def __init__(self,
host,
port,
is_multilingual=False,
lang=None,
translate=False,
model="small",
):
self.client = Client(host, port, is_multilingual, lang, translate, model)
self.client = Client(host, port, lang, translate, model)
def __call__(self, audio=None, hls_url=None):
"""
-3
View File
@@ -155,7 +155,6 @@ class TranscriptionServer:
options["model"] = faster_whisper_custom_model_path
client = ServeClientFasterWhisper(
websocket,
multilingual=False,
language=options["language"],
task=options["task"],
client_uid=options["uid"],
@@ -559,7 +558,6 @@ class ServeClientFasterWhisper(ServeClientBase):
websocket,
task="transcribe",
device=None,
multilingual=False,
language=None,
client_uid=None,
model="small.en",
@@ -576,7 +574,6 @@ class ServeClientFasterWhisper(ServeClientBase):
websocket (WebSocket): The WebSocket connection for the client.
task (str, optional): The task type, e.g., "transcribe." Defaults to "transcribe".
device (str, optional): The device type for Whisper, "cuda" or "cpu". Defaults to None.
multilingual (bool, optional): Whether the client supports multilingual transcription. Defaults to False.
language (str, optional): The language for transcription. Defaults to None.
client_uid (str, optional): A unique identifier for the client. Defaults to None.