scribe-cli 0.7.6__tar.gz → 0.7.7__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.7.6/scribe_cli.egg-info → scribe_cli-0.7.7}/PKG-INFO +5 -4
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/README.md +4 -4
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/pyproject.toml +1 -0
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/scribe/_version.py +2 -2
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/scribe/app.py +15 -6
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/scribe/keyboard.py +20 -3
- {scribe_cli-0.7.6 → scribe_cli-0.7.7/scribe_cli.egg-info}/PKG-INFO +5 -4
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/scribe_cli.egg-info/requires.txt +1 -0
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/.github/workflows/pypi.yml +0 -0
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/.gitignore +0 -0
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/LICENSE +0 -0
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/scribe/__init__.py +0 -0
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/scribe/audio.py +0 -0
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/scribe/install_desktop.py +0 -0
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/scribe/models.py +0 -0
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/scribe/models.toml +0 -0
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/scribe/saverecording.py +0 -0
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/scribe/testpynput.py +0 -0
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/scribe/util.py +0 -0
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/scribe_cli.egg-info/SOURCES.txt +0 -0
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/scribe_cli.egg-info/dependency_links.txt +0 -0
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/scribe_cli.egg-info/entry_points.txt +0 -0
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/scribe_cli.egg-info/top_level.txt +0 -0
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/scribe_data/__init__.py +0 -0
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/scribe_data/share/icon.jpg +0 -0
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/scribe_data/templates/scribe.desktop +0 -0
- {scribe_cli-0.7.6 → scribe_cli-0.7.7}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: scribe-cli
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.7
|
|
4
4
|
Summary: scribe is a local speech recognition tool that provides real-time transcription using vosk and whisper AI, with the goal of serving as a virtual keyboard on a computer
|
|
5
5
|
Author-email: Mahé Perrette <mahe.perrette@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -44,6 +44,7 @@ Requires-Dist: sounddevice
|
|
|
44
44
|
Requires-Dist: tqdm
|
|
45
45
|
Requires-Dist: requests
|
|
46
46
|
Requires-Dist: pyperclip
|
|
47
|
+
Requires-Dist: unidecode
|
|
47
48
|
Provides-Extra: keyboard
|
|
48
49
|
Requires-Dist: pynput; extra == "keyboard"
|
|
49
50
|
Provides-Extra: whisper
|
|
@@ -60,7 +61,7 @@ Requires-Dist: vosk; extra == "all"
|
|
|
60
61
|
Requires-Dist: pystray; extra == "all"
|
|
61
62
|
|
|
62
63
|
[]()
|
|
63
|
-
[](https://pypi.org/project/
|
|
64
|
+
[](https://pypi.org/project/scribe-cli)
|
|
64
65
|
|
|
65
66
|
# Scribe
|
|
66
67
|
|
|
@@ -83,7 +84,7 @@ sudo apt-get install portaudio19-dev xclip
|
|
|
83
84
|
See additional requirements for the [icon tray](#system-tray-icon-experimental) and [keyboard](#virtual-keyboard-experimental) options. The python dependencies should be dealt with automatically:
|
|
84
85
|
|
|
85
86
|
```bash
|
|
86
|
-
pip install scribe-cli[all]
|
|
87
|
+
pip install scribe-cli[all]
|
|
87
88
|
```
|
|
88
89
|
|
|
89
90
|
(note the `-cli` suffix for client)
|
|
@@ -121,7 +122,7 @@ With the `whisker` model you need to stop the registration manually before the t
|
|
|
121
122
|
there is a maximum duration after which it will stop by itself, which is setup to 60s by default (unless `--duration` is set to something else).
|
|
122
123
|
|
|
123
124
|
The `vosk` backend is much faster and very good at doing real-time transcription for one language, but tended to make more mistakes in my tests and it does not do punctuation.
|
|
124
|
-
|
|
125
|
+
It becomes really powerful when used for longer or interactive typing session with the [keyboard](#virtual-keyboard-experimental) option, e.g. to make notes or chat with an AI.
|
|
125
126
|
There are many [vosk models](https://alphacephei.com/vosk/models) available, and here a few are associated to [a handful of languages](scribe/models.toml) `en`, `fr`, `it`, `de` (so far).
|
|
126
127
|
|
|
127
128
|
To skip the initial selection menu you can do:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[]()
|
|
2
|
-
[](https://pypi.org/project/
|
|
2
|
+
[](https://pypi.org/project/scribe-cli)
|
|
3
3
|
|
|
4
4
|
# Scribe
|
|
5
5
|
|
|
@@ -22,7 +22,7 @@ sudo apt-get install portaudio19-dev xclip
|
|
|
22
22
|
See additional requirements for the [icon tray](#system-tray-icon-experimental) and [keyboard](#virtual-keyboard-experimental) options. The python dependencies should be dealt with automatically:
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
pip install scribe-cli[all]
|
|
25
|
+
pip install scribe-cli[all]
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
(note the `-cli` suffix for client)
|
|
@@ -60,7 +60,7 @@ With the `whisker` model you need to stop the registration manually before the t
|
|
|
60
60
|
there is a maximum duration after which it will stop by itself, which is setup to 60s by default (unless `--duration` is set to something else).
|
|
61
61
|
|
|
62
62
|
The `vosk` backend is much faster and very good at doing real-time transcription for one language, but tended to make more mistakes in my tests and it does not do punctuation.
|
|
63
|
-
|
|
63
|
+
It becomes really powerful when used for longer or interactive typing session with the [keyboard](#virtual-keyboard-experimental) option, e.g. to make notes or chat with an AI.
|
|
64
64
|
There are many [vosk models](https://alphacephei.com/vosk/models) available, and here a few are associated to [a handful of languages](scribe/models.toml) `en`, `fr`, `it`, `de` (so far).
|
|
65
65
|
|
|
66
66
|
To skip the initial selection menu you can do:
|
|
@@ -124,4 +124,4 @@ e.g.
|
|
|
124
124
|
scribe-install --backend whisper --model small
|
|
125
125
|
```
|
|
126
126
|
|
|
127
|
-
After that just typing Cmd + scri... at any time from any where will conveniently start the app in its own terminal with the prescribed options.
|
|
127
|
+
After that just typing Cmd + scri... at any time from any where will conveniently start the app in its own terminal with the prescribed options.
|
|
@@ -151,6 +151,7 @@ def get_parser():
|
|
|
151
151
|
parser.add_argument("--keyboard", action="store_true")
|
|
152
152
|
parser.add_argument("--no-clipboard", dest="clipboard", action="store_false")
|
|
153
153
|
parser.add_argument("--latency", default=0, type=float, help="keyboard latency")
|
|
154
|
+
parser.add_argument("--ascii", action="store_true", help="Use unidecode for keyboard typing in ascii")
|
|
154
155
|
|
|
155
156
|
group = parser.add_argument_group("whisper options")
|
|
156
157
|
group.add_argument("--duration", default=120, type=int, help="Max duration of the whisper recording (default %(default)ss)")
|
|
@@ -164,7 +165,7 @@ def get_parser():
|
|
|
164
165
|
|
|
165
166
|
|
|
166
167
|
# Commencer l'enregistrement
|
|
167
|
-
def start_recording(micro, transcriber, clipboard=True, keyboard=False, latency=0, **greetings):
|
|
168
|
+
def start_recording(micro, transcriber, clipboard=True, keyboard=False, latency=0, ascii=False, **greetings):
|
|
168
169
|
|
|
169
170
|
if keyboard:
|
|
170
171
|
from scribe.keyboard import type_text
|
|
@@ -184,7 +185,7 @@ def start_recording(micro, transcriber, clipboard=True, keyboard=False, latency=
|
|
|
184
185
|
clear_line()
|
|
185
186
|
print(result.get('text'))
|
|
186
187
|
if keyboard:
|
|
187
|
-
type_text(result['text'] + " ", interval=latency) # Simulate typing
|
|
188
|
+
type_text(result['text'] + " ", interval=latency, ascii=ascii) # Simulate typing
|
|
188
189
|
|
|
189
190
|
if clipboard:
|
|
190
191
|
fulltext += result['text'] + " "
|
|
@@ -280,7 +281,7 @@ def main(args=None):
|
|
|
280
281
|
transcriber = get_transcriber(o, prompt=o.prompt)
|
|
281
282
|
print(f">>> Model {transcriber.model_name} from {transcriber.backend} selected. Keyboard [{'on' if o.keyboard else 'off'}]. Clipboard [{'on' if o.clipboard else 'off'}] <<<")
|
|
282
283
|
if o.prompt:
|
|
283
|
-
print(f"Choose any of the following actions
|
|
284
|
+
print(f"Choose any of the following actions (or any command-line toggle flag by name)")
|
|
284
285
|
print(f"[q] quit")
|
|
285
286
|
print(f"[e] change model")
|
|
286
287
|
print(f"[x] toggle app [{toggle[o.app]}] -> [{toggle[not o.app]}]")
|
|
@@ -290,7 +291,7 @@ def main(args=None):
|
|
|
290
291
|
print(f"[t] change duration (currently {transcriber.timeout}s)")
|
|
291
292
|
print(f"[b] change silence duration (currently {transcriber.silence_duration}s)")
|
|
292
293
|
print(f"[a] toggle auto-restart after silence [{toggle[transcriber.restart_after_silence]}] -> [{toggle[not transcriber.restart_after_silence]}]")
|
|
293
|
-
print(colored(f"Press [Enter]
|
|
294
|
+
print(colored(f"Press [Enter] to start recording.", "BOLD"))
|
|
294
295
|
|
|
295
296
|
key = input()
|
|
296
297
|
if key == "q":
|
|
@@ -324,19 +325,27 @@ def main(args=None):
|
|
|
324
325
|
except:
|
|
325
326
|
print("Invalid duration. Must be an integer.")
|
|
326
327
|
continue
|
|
328
|
+
if key:
|
|
329
|
+
if hasattr(o, key) and isinstance(getattr(o, key), bool):
|
|
330
|
+
setattr(o, key, not getattr(o, key))
|
|
331
|
+
print(f"Toggle {key} to [{getattr(o, key)}].")
|
|
332
|
+
print(f"Invalid choice: {key}.")
|
|
333
|
+
continue
|
|
327
334
|
|
|
328
335
|
if o.app:
|
|
329
336
|
greetings = dict(
|
|
330
337
|
start_message = "Listening... Use the try icon menu to stop.",
|
|
331
338
|
)
|
|
332
|
-
app = create_app(micro, transcriber, clipboard=o.clipboard,
|
|
339
|
+
app = create_app(micro, transcriber, clipboard=o.clipboard,
|
|
340
|
+
keyboard=o.keyboard, latency=o.latency, ascii=o.ascii, **greetings)
|
|
333
341
|
print("Starting app...")
|
|
334
342
|
app.run()
|
|
335
343
|
else:
|
|
336
344
|
greetings = dict(
|
|
337
345
|
start_message = "Listening... Press Ctrl+C to stop.",
|
|
338
346
|
)
|
|
339
|
-
start_recording(micro, transcriber, clipboard=o.clipboard,
|
|
347
|
+
start_recording(micro, transcriber, clipboard=o.clipboard,
|
|
348
|
+
keyboard=o.keyboard, latency=o.latency, ascii=o.ascii, **greetings)
|
|
340
349
|
|
|
341
350
|
# if we arrived so far, that means we pressed Ctrl + C anyway, and need Enter to move on.
|
|
342
351
|
# So we leave the wider range of options to change the model.
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
"""
|
|
3
3
|
import platform
|
|
4
4
|
import time
|
|
5
|
+
import unidecode
|
|
6
|
+
import logging
|
|
5
7
|
|
|
6
8
|
try:
|
|
7
9
|
# import pyautogui
|
|
@@ -30,11 +32,24 @@ def paste_text():
|
|
|
30
32
|
keyboard.release('v')
|
|
31
33
|
keyboard.release(Key.ctrl)
|
|
32
34
|
|
|
33
|
-
def
|
|
35
|
+
def safe_type_text(text):
|
|
36
|
+
"""I got key errors with the uinput mode, so I'm using unidecode to convert
|
|
37
|
+
the text to ASCII before typing it."""
|
|
38
|
+
try:
|
|
39
|
+
keyboard.type(text)
|
|
40
|
+
except KeyError:
|
|
41
|
+
asciitext = unidecode.unidecode(text)
|
|
42
|
+
logging.warning(f"Key error with {text} -> convert to {asciitext}")
|
|
43
|
+
keyboard.type(asciitext)
|
|
44
|
+
|
|
45
|
+
def type_text(text, interval=0, paste=False, ascii=False):
|
|
34
46
|
# Simulate typing a string
|
|
35
47
|
# import subprocess
|
|
36
48
|
# subprocess.run(["ydotool", "type", text])
|
|
37
49
|
|
|
50
|
+
if ascii:
|
|
51
|
+
text = unidecode.unidecode(text)
|
|
52
|
+
|
|
38
53
|
if paste:
|
|
39
54
|
import pyperclip
|
|
40
55
|
keep_state = pyperclip.paste()
|
|
@@ -45,7 +60,9 @@ def type_text(text, interval=0, paste=False):
|
|
|
45
60
|
|
|
46
61
|
if interval > 0:
|
|
47
62
|
for c in text:
|
|
48
|
-
keyboard.type(c)
|
|
63
|
+
# keyboard.type(c)
|
|
64
|
+
safe_type_text(c)
|
|
49
65
|
time.sleep(interval)
|
|
50
66
|
else:
|
|
51
|
-
keyboard.type(text)
|
|
67
|
+
# keyboard.type(text)
|
|
68
|
+
safe_type_text(text)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: scribe-cli
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.7
|
|
4
4
|
Summary: scribe is a local speech recognition tool that provides real-time transcription using vosk and whisper AI, with the goal of serving as a virtual keyboard on a computer
|
|
5
5
|
Author-email: Mahé Perrette <mahe.perrette@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -44,6 +44,7 @@ Requires-Dist: sounddevice
|
|
|
44
44
|
Requires-Dist: tqdm
|
|
45
45
|
Requires-Dist: requests
|
|
46
46
|
Requires-Dist: pyperclip
|
|
47
|
+
Requires-Dist: unidecode
|
|
47
48
|
Provides-Extra: keyboard
|
|
48
49
|
Requires-Dist: pynput; extra == "keyboard"
|
|
49
50
|
Provides-Extra: whisper
|
|
@@ -60,7 +61,7 @@ Requires-Dist: vosk; extra == "all"
|
|
|
60
61
|
Requires-Dist: pystray; extra == "all"
|
|
61
62
|
|
|
62
63
|
[]()
|
|
63
|
-
[](https://pypi.org/project/
|
|
64
|
+
[](https://pypi.org/project/scribe-cli)
|
|
64
65
|
|
|
65
66
|
# Scribe
|
|
66
67
|
|
|
@@ -83,7 +84,7 @@ sudo apt-get install portaudio19-dev xclip
|
|
|
83
84
|
See additional requirements for the [icon tray](#system-tray-icon-experimental) and [keyboard](#virtual-keyboard-experimental) options. The python dependencies should be dealt with automatically:
|
|
84
85
|
|
|
85
86
|
```bash
|
|
86
|
-
pip install scribe-cli[all]
|
|
87
|
+
pip install scribe-cli[all]
|
|
87
88
|
```
|
|
88
89
|
|
|
89
90
|
(note the `-cli` suffix for client)
|
|
@@ -121,7 +122,7 @@ With the `whisker` model you need to stop the registration manually before the t
|
|
|
121
122
|
there is a maximum duration after which it will stop by itself, which is setup to 60s by default (unless `--duration` is set to something else).
|
|
122
123
|
|
|
123
124
|
The `vosk` backend is much faster and very good at doing real-time transcription for one language, but tended to make more mistakes in my tests and it does not do punctuation.
|
|
124
|
-
|
|
125
|
+
It becomes really powerful when used for longer or interactive typing session with the [keyboard](#virtual-keyboard-experimental) option, e.g. to make notes or chat with an AI.
|
|
125
126
|
There are many [vosk models](https://alphacephei.com/vosk/models) available, and here a few are associated to [a handful of languages](scribe/models.toml) `en`, `fr`, `it`, `de` (so far).
|
|
126
127
|
|
|
127
128
|
To skip the initial selection menu you can do:
|
|
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
|