Skip to content

Commit

Permalink
Remove multilingual from client. Remove multilingual from faster whis…
Browse files Browse the repository at this point in the history
…per backend. Disable task dropdown when capturing in chrome extension.
  • Loading branch information
lightwastak3n committed Feb 2, 2024
1 parent b098b52 commit e697574
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Audio-Transcription-Chrome/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
16 changes: 5 additions & 11 deletions whisper_live/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ def __init__(
self,
host=None,
port=None,
is_multilingual=False,
lang=None,
translate=False,
model="small",
Expand All @@ -92,8 +91,7 @@ def __init__(
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
Expand All @@ -107,7 +105,6 @@ def __init__(
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
Expand Down Expand Up @@ -245,7 +242,7 @@ def on_open(self, ws):
"""
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:
Expand All @@ -259,7 +256,6 @@ def on_open(self, ws):
json.dumps(
{
"uid": self.uid,
"multilingual": self.multilingual,
"language": self.language,
"task": self.task,
"model": self.model,
Expand Down Expand Up @@ -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:
Expand All @@ -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):
"""
Expand Down
3 changes: 0 additions & 3 deletions whisper_live/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ def recv_audio(self,
options["model"] = faster_whisper_custom_model_path
client = ServeClientFasterWhisper(
websocket,
multilingual=False,
language=options["language"],
task=options["task"],
client_uid=options["uid"],
Expand Down Expand Up @@ -559,7 +558,6 @@ def __init__(
websocket,
task="transcribe",
device=None,
multilingual=False,
language=None,
client_uid=None,
model="small.en",
Expand All @@ -576,7 +574,6 @@ def __init__(
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.
Expand Down

0 comments on commit e697574

Please sign in to comment.