scribe-cli 0.5.0__tar.gz → 0.5.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {scribe_cli-0.5.0/scribe_cli.egg-info → scribe_cli-0.5.1}/PKG-INFO +1 -1
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/scribe/_version.py +2 -2
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/scribe/models.py +8 -6
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/scribe/streamer.py +5 -5
- {scribe_cli-0.5.0 → scribe_cli-0.5.1/scribe_cli.egg-info}/PKG-INFO +1 -1
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/.github/workflows/pypi.yml +0 -0
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/.gitignore +0 -0
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/LICENSE +0 -0
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/README.md +0 -0
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/pyproject.toml +0 -0
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/scribe/__init__.py +0 -0
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/scribe/audio.py +0 -0
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/scribe/install_desktop.py +0 -0
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/scribe/keyboard.py +0 -0
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/scribe/models.toml +0 -0
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/scribe/saverecording.py +0 -0
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/scribe/testpynput.py +0 -0
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/scribe/util.py +0 -0
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/scribe_cli.egg-info/SOURCES.txt +0 -0
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/scribe_cli.egg-info/dependency_links.txt +0 -0
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/scribe_cli.egg-info/entry_points.txt +0 -0
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/scribe_cli.egg-info/requires.txt +0 -0
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/scribe_cli.egg-info/top_level.txt +0 -0
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/scribe_data/__init__.py +0 -0
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/scribe_data/share/icon.jpg +0 -0
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/scribe_data/templates/scribe.desktop +0 -0
- {scribe_cli-0.5.0 → scribe_cli-0.5.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: scribe-cli
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.1
|
|
4
4
|
Summary: scribe is a local speech recognition tool that provides real-time transcription using vosk and whisper AI.
|
|
5
5
|
Author-email: Mahé Perrette <mahe.perrette@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import json
|
|
3
3
|
import numpy as np
|
|
4
|
+
import time
|
|
4
5
|
from scribe.util import download_model
|
|
5
6
|
|
|
6
7
|
VOSK_MODELS_FOLDER = os.path.join(os.environ.get("HOME"),
|
|
@@ -9,21 +10,22 @@ VOSK_MODELS_FOLDER = os.path.join(os.environ.get("HOME"),
|
|
|
9
10
|
|
|
10
11
|
class AbstractTranscriber:
|
|
11
12
|
backend = None
|
|
12
|
-
def __init__(self, model, model_name=None, language=None, samplerate=16000,
|
|
13
|
+
def __init__(self, model, model_name=None, language=None, samplerate=16000, timeout=None, model_kwargs={}):
|
|
13
14
|
self.model_name = model_name
|
|
14
15
|
self.language = language
|
|
15
16
|
self.model = model
|
|
16
17
|
self.model_kwargs = model_kwargs
|
|
17
18
|
self.samplerate = samplerate
|
|
18
|
-
self.
|
|
19
|
+
self.timeout = timeout
|
|
19
20
|
self.one_second_bytes = self.samplerate * 2 # 16-bit audio, 1 channel ~ 32000 bytes
|
|
20
21
|
self.audio_buffer = b''
|
|
22
|
+
self.start_time = time.time()
|
|
21
23
|
|
|
22
|
-
def get_elapsed(self
|
|
23
|
-
return
|
|
24
|
+
def get_elapsed(self):
|
|
25
|
+
return time.time() - self.start_time
|
|
24
26
|
|
|
25
|
-
def is_overtime(self
|
|
26
|
-
return
|
|
27
|
+
def is_overtime(self):
|
|
28
|
+
return time.time() - self.start_time > self.timeout
|
|
27
29
|
|
|
28
30
|
def transcribe_realtime_audio(self, audio_bytes=b""):
|
|
29
31
|
self.audio_buffer += audio_bytes
|
|
@@ -152,7 +152,7 @@ def get_transcriber(o, prompt=True):
|
|
|
152
152
|
transcriber = VoskTranscriber(model_name=model,
|
|
153
153
|
language=o.language,
|
|
154
154
|
samplerate=o.samplerate,
|
|
155
|
-
|
|
155
|
+
timeout=None, # vosk keeps going (no timeout)
|
|
156
156
|
model_kwargs={"data_folder": o.data_folder})
|
|
157
157
|
except Exception as error:
|
|
158
158
|
print(error)
|
|
@@ -160,7 +160,7 @@ def get_transcriber(o, prompt=True):
|
|
|
160
160
|
exit(1)
|
|
161
161
|
|
|
162
162
|
elif backend == "whisper":
|
|
163
|
-
transcriber = WhisperTranscriber(model_name=model, language=o.language, samplerate=o.samplerate,
|
|
163
|
+
transcriber = WhisperTranscriber(model_name=model, language=o.language, samplerate=o.samplerate, timeout=o.duration)
|
|
164
164
|
|
|
165
165
|
else:
|
|
166
166
|
raise ValueError(f"Unknown backend: {backend}")
|
|
@@ -216,7 +216,7 @@ def main(args=None):
|
|
|
216
216
|
print(f"[k] toggle keyboard [{'off' if o.keyboard else 'on'}]")
|
|
217
217
|
print(f"[c] toggle clipboard [{'off' if o.clipboard else 'on'}]")
|
|
218
218
|
if transcriber.backend == "whisper":
|
|
219
|
-
print(f"[t] change duration (currently {transcriber.
|
|
219
|
+
print(f"[t] change duration (currently {transcriber.timeout}s)")
|
|
220
220
|
print(colored(f"Press [Enter] or any other key to start recording.", "BOLD"))
|
|
221
221
|
|
|
222
222
|
key = input()
|
|
@@ -232,9 +232,9 @@ def main(args=None):
|
|
|
232
232
|
o.clipboard = not o.clipboard
|
|
233
233
|
continue
|
|
234
234
|
if key == "t":
|
|
235
|
-
duration = input(f"Enter new duration in seconds (current: {transcriber.
|
|
235
|
+
duration = input(f"Enter new duration in seconds (current: {transcriber.timeout}): ")
|
|
236
236
|
try:
|
|
237
|
-
o.duration = transcriber.
|
|
237
|
+
o.duration = transcriber.timeout = int(duration)
|
|
238
238
|
except:
|
|
239
239
|
print("Invalid duration. Must be an integer.")
|
|
240
240
|
continue
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: scribe-cli
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.1
|
|
4
4
|
Summary: scribe is a local speech recognition tool that provides real-time transcription using vosk and whisper AI.
|
|
5
5
|
Author-email: Mahé Perrette <mahe.perrette@gmail.com>
|
|
6
6
|
License: MIT License
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|