scribe-cli 0.11.0__tar.gz → 0.12.0__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.
Files changed (30) hide show
  1. {scribe_cli-0.11.0/scribe_cli.egg-info → scribe_cli-0.12.0}/PKG-INFO +8 -9
  2. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/README.md +8 -9
  3. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/scribe/_version.py +2 -2
  4. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/scribe/app.py +20 -27
  5. {scribe_cli-0.11.0 → scribe_cli-0.12.0/scribe_cli.egg-info}/PKG-INFO +8 -9
  6. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/.github/workflows/pypi.yml +0 -0
  7. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/.gitignore +0 -0
  8. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/LICENSE +0 -0
  9. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/icon.xcf +0 -0
  10. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/pyproject.toml +0 -0
  11. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/scribe/__init__.py +0 -0
  12. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/scribe/audio.py +0 -0
  13. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/scribe/install_desktop.py +0 -0
  14. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/scribe/keyboard.py +0 -0
  15. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/scribe/models.py +0 -0
  16. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/scribe/models.toml +0 -0
  17. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/scribe/saverecording.py +0 -0
  18. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/scribe/testpynput.py +0 -0
  19. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/scribe/util.py +0 -0
  20. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/scribe_cli.egg-info/SOURCES.txt +0 -0
  21. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/scribe_cli.egg-info/dependency_links.txt +0 -0
  22. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/scribe_cli.egg-info/entry_points.txt +0 -0
  23. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/scribe_cli.egg-info/requires.txt +0 -0
  24. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/scribe_cli.egg-info/top_level.txt +0 -0
  25. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/scribe_data/__init__.py +0 -0
  26. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/scribe_data/share/icon.png +0 -0
  27. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/scribe_data/share/icon_recording.png +0 -0
  28. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/scribe_data/share/icon_writing.png +0 -0
  29. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/scribe_data/templates/scribe.desktop +0 -0
  30. {scribe_cli-0.11.0 → scribe_cli-0.12.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: scribe-cli
3
- Version: 0.11.0
3
+ Version: 0.12.0
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
@@ -158,7 +158,7 @@ The content of the (full) transcription is then pasted to the clipboard, and it
158
158
  Alternatively an output file can be indicated:
159
159
 
160
160
  ```bash
161
- --keyboard -o transcription.txt
161
+ scribe -o transcription.txt
162
162
  ```
163
163
 
164
164
  ### Virtual keyboard (experimental)
@@ -196,8 +196,8 @@ To activate start with:
196
196
  scribe --app
197
197
  ```
198
198
  or toggle the app option in the interactive menu. The scribe icon will show, with Record and other options. The icon will change based on what the app is doing. It is possible to choose from a set
199
- of predefined models, or to Quit and choose from the terminal before pressing Enter again.
200
- For the vosk model, there are only two states : recording + transcribing or Idle. For the whisper model there are three states visible from the icon: recording, transcribing and idle/waiting.
199
+ of predefined models (controlled by `--vosk-models` and `whisper-models`) and options, or to Quit and choose from the terminal before pressing Enter again.
200
+ For the vosk model, there are only two states : recording + transcribing or Idle. For the whisper model there are three states visible from the icon: recording/waiting, transcribing and idle.
201
201
  That option requires `pystray` to be installed. This is included with the `pip install ...[all]` option. In Ubuntu the following dependencies were required to make the menus appear:
202
202
 
203
203
  ```bash
@@ -205,6 +205,8 @@ sudo apt install libcairo-dev libgirepository1.0-dev gir1.2-appindicator3-0.1
205
205
  pip install PyGObject
206
206
  ```
207
207
 
208
+ <img src=https://github.com/user-attachments/assets/4c97f4b1-1a65-4d49-9f5a-a9f4287cfa5a width=300px>
209
+
208
210
  ## Start as an application in GNOME
209
211
 
210
212
  If you run Ubuntu (or else?) with GNOME, the script `scribe-install [...]` will create a `scribe.desktop` file and place it under `$HOME/.local/share/applications`
@@ -218,13 +220,10 @@ scribe-install --clipboard --api YOUROPENAIAPIKEY
218
220
  ```
219
221
  (`--api` is optional and only useful if you plan to use `openaiapi` backend later on)
220
222
 
221
- And to make an app running outside the terminal:
222
-
223
+ It is also possible to run an app fully outside the terminal:
223
224
  ```bash
224
- scribe-install --backend openaiapi --name "Scribe App" --keyboard --clipboard --app --no-prompt --no-terminal --api YOUROPENAIAPIKEY
225
+ scribe-install --backend openaiapi --name "Scribe App" --keyboard --clipboard --app --no-prompt --no-terminal --restart-after-silence --api YOUROPENAIAPIKEY --vosk-models vosk-model-fr-0.22 --whisper-models small turbo
225
226
  ```
226
- This will install two separate apps (names "Scribe" and "Scribe App")
227
-
228
227
 
229
228
  ## Fine tuning
230
229
 
@@ -90,7 +90,7 @@ The content of the (full) transcription is then pasted to the clipboard, and it
90
90
  Alternatively an output file can be indicated:
91
91
 
92
92
  ```bash
93
- --keyboard -o transcription.txt
93
+ scribe -o transcription.txt
94
94
  ```
95
95
 
96
96
  ### Virtual keyboard (experimental)
@@ -128,8 +128,8 @@ To activate start with:
128
128
  scribe --app
129
129
  ```
130
130
  or toggle the app option in the interactive menu. The scribe icon will show, with Record and other options. The icon will change based on what the app is doing. It is possible to choose from a set
131
- of predefined models, or to Quit and choose from the terminal before pressing Enter again.
132
- For the vosk model, there are only two states : recording + transcribing or Idle. For the whisper model there are three states visible from the icon: recording, transcribing and idle/waiting.
131
+ of predefined models (controlled by `--vosk-models` and `whisper-models`) and options, or to Quit and choose from the terminal before pressing Enter again.
132
+ For the vosk model, there are only two states : recording + transcribing or Idle. For the whisper model there are three states visible from the icon: recording/waiting, transcribing and idle.
133
133
  That option requires `pystray` to be installed. This is included with the `pip install ...[all]` option. In Ubuntu the following dependencies were required to make the menus appear:
134
134
 
135
135
  ```bash
@@ -137,6 +137,8 @@ sudo apt install libcairo-dev libgirepository1.0-dev gir1.2-appindicator3-0.1
137
137
  pip install PyGObject
138
138
  ```
139
139
 
140
+ <img src=https://github.com/user-attachments/assets/4c97f4b1-1a65-4d49-9f5a-a9f4287cfa5a width=300px>
141
+
140
142
  ## Start as an application in GNOME
141
143
 
142
144
  If you run Ubuntu (or else?) with GNOME, the script `scribe-install [...]` will create a `scribe.desktop` file and place it under `$HOME/.local/share/applications`
@@ -150,13 +152,10 @@ scribe-install --clipboard --api YOUROPENAIAPIKEY
150
152
  ```
151
153
  (`--api` is optional and only useful if you plan to use `openaiapi` backend later on)
152
154
 
153
- And to make an app running outside the terminal:
154
-
155
+ It is also possible to run an app fully outside the terminal:
155
156
  ```bash
156
- scribe-install --backend openaiapi --name "Scribe App" --keyboard --clipboard --app --no-prompt --no-terminal --api YOUROPENAIAPIKEY
157
+ scribe-install --backend openaiapi --name "Scribe App" --keyboard --clipboard --app --no-prompt --no-terminal --restart-after-silence --api YOUROPENAIAPIKEY --vosk-models vosk-model-fr-0.22 --whisper-models small turbo
157
158
  ```
158
- This will install two separate apps (names "Scribe" and "Scribe App")
159
-
160
159
 
161
160
  ## Fine tuning
162
161
 
@@ -165,4 +164,4 @@ Best is to check the available options in the online help:
165
164
 
166
165
  ```bash
167
166
  scribe --help
168
- ```
167
+ ```
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.11.0'
16
- __version_tuple__ = version_tuple = (0, 11, 0)
15
+ __version__ = version = '0.12.0'
16
+ __version_tuple__ = version_tuple = (0, 12, 0)
@@ -204,13 +204,17 @@ def get_parser():
204
204
  group.add_argument("--silence", default=2, type=float, help="silence duration (default %(default)s s)")
205
205
  group.add_argument("--silence-db", default=-30, type=float, help="silence magnitude in decibel (default %(default)s db)")
206
206
  group.add_argument("-a", "--restart-after-silence", action="store_true", help="Restart the recording after a transcription triggered by a silence")
207
+ group.add_argument("--download-folder-whisper", help="Folder to store Whisper models.")
207
208
 
208
209
  group = parser.add_argument_group("whisper api")
209
210
  group.add_argument("--api-key",
210
211
  help="API key for the Whisper API backend.")
211
212
 
213
+ group = parser.add_argument_group("App")
214
+ group.add_argument("--vosk-models", nargs="*", help="vosk models available for the app mode", default=vosk_models)
215
+ group.add_argument("--whisper-models", nargs="*", help="whisper models available for the app mode", default=whisper_models)
216
+
212
217
  parser.add_argument("--download-folder-vosk", help="Folder to store Vosk models.")
213
- parser.add_argument("--download-folder-whisper", help="Folder to store Whisper models.")
214
218
 
215
219
  return parser
216
220
 
@@ -272,15 +276,7 @@ def create_app(micro, transcriber, other_transcribers=None, **kwargs):
272
276
 
273
277
  def update_icon(icon, force=False):
274
278
  transcriber = icon._transcriber
275
- if transcriber.recording and transcriber.waiting:
276
- # this is the situation with the whisper backend when the microphone is recording
277
- # but we wait for the speaker to speak (silence)
278
- if force or getattr(icon, "_icon_label", None) != None:
279
- icon.icon = image
280
- icon._icon_label = None
281
- icon.update_menu()
282
-
283
- elif transcriber.recording:
279
+ if transcriber.recording:
284
280
  if force or getattr(icon, "_icon_label", None) != "recording":
285
281
  icon.icon = image_recording
286
282
  icon._icon_label = "recording"
@@ -326,8 +322,8 @@ def create_app(micro, transcriber, other_transcribers=None, **kwargs):
326
322
  def callback_record(icon, item):
327
323
  transcriber = icon._transcriber
328
324
  if transcriber.busy:
329
- transcriber.log("Still busy recording or transcribing.")
330
- return
325
+ # transcriber.log("Still busy recording or transcribing.")
326
+ return callback_stop_recording(icon, item) # play / stop behavior
331
327
 
332
328
  if hasattr(icon, "_recording_thread") and icon._recording_thread.is_alive():
333
329
  icon._recording_thread.join()
@@ -357,18 +353,10 @@ def create_app(micro, transcriber, other_transcribers=None, **kwargs):
357
353
  # icon.menu.items[0].__name__ = f"Record [{str(item)}]"
358
354
  icon._model_selection = False
359
355
  icon.update_menu()
360
- icon.notify(f"Set {transcriber.backend} {transcriber.model_name}")
361
-
362
- def callback_info(icon, item):
363
- transcriber = icon._transcriber
364
- # icon.notify(f"scribe {transcriber.backend} {transcriber.model_name}")
365
- title = f"""{transcriber.backend} :: {transcriber.model_name}"""
366
- info = [name for name in kwargs if isinstance(kwargs[name], bool) and kwargs[name]]
367
- icon.notify(" | ".join(info), title=title)
368
356
 
369
357
  def callback_toggle_option(icon, item):
358
+ callback_stop_recording(icon, item)
370
359
  kwargs[str(item)] = not kwargs[str(item)]
371
- callback_info(icon, item)
372
360
 
373
361
  def is_model_selection(item):
374
362
  return icon._model_selection
@@ -379,19 +367,24 @@ def create_app(micro, transcriber, other_transcribers=None, **kwargs):
379
367
  def is_not_recording(item):
380
368
  return not is_recording(item) and not is_model_selection(item)
381
369
 
370
+ def is_checked(item):
371
+ return icon._transcriber.model_name == str(item)
372
+
373
+ def is_checked_option(item):
374
+ return kwargs[str(item)]
375
+
382
376
  modeltitle = f"{transcriber.backend} :: {transcriber.model_name}"
383
377
  title = f"scribe :: {modeltitle}"
384
378
 
385
379
  menus = []
386
- menus.append(Item(f"Record" if len(other_transcribers_dict) <= 1 else f"Record", callback_record, visible=is_not_recording))
380
+ menus.append(Item(f"Record", callback_record, visible=is_not_recording, default=True))
387
381
  menus.append(Item("Stop", callback_stop_recording, visible=is_recording))
388
382
  menus.append(Item("Choose Model", pystrayMenu(
389
- *(Item(f"{name}", callback_set_model) for name in other_transcribers_dict)))
383
+ *(Item(f"{name}", callback_set_model, checked=is_checked) for name in other_transcribers_dict)))
390
384
  )
391
385
  menus.append(Item("Toggle Options", pystrayMenu(
392
- *(Item(f"{name}", callback_toggle_option) for name in kwargs if isinstance(kwargs[name], bool))))
386
+ *(Item(f"{name}", callback_toggle_option, checked=is_checked_option) for name in kwargs if isinstance(kwargs[name], bool))))
393
387
  )
394
- menus.append(Item(f"Info", callback_info))
395
388
  menus.append(Item('Quit', callback_quit))
396
389
 
397
390
  # Create a menu
@@ -537,8 +530,8 @@ def main(args=None):
537
530
 
538
531
  app = create_app(micro, transcriber, other_transcribers=[
539
532
  {**vars(o), "backend": "openaiapi", "model": "whisper-1"},
540
- *[{**vars(o), "backend": "whisper", "model": model} for model in whisper_models],
541
- *[{**vars(o), "backend": "vosk", "model": model} for model in vosk_models]],
533
+ *[{**vars(o), "backend": "whisper", "model": model} for model in o.whisper_models],
534
+ *[{**vars(o), "backend": "vosk", "model": model} for model in o.vosk_models]],
542
535
  clipboard=o.clipboard, output_file=o.output_file,
543
536
  keyboard=o.keyboard, latency=o.latency, ascii=o.ascii, **greetings)
544
537
  print("Starting app...")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: scribe-cli
3
- Version: 0.11.0
3
+ Version: 0.12.0
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
@@ -158,7 +158,7 @@ The content of the (full) transcription is then pasted to the clipboard, and it
158
158
  Alternatively an output file can be indicated:
159
159
 
160
160
  ```bash
161
- --keyboard -o transcription.txt
161
+ scribe -o transcription.txt
162
162
  ```
163
163
 
164
164
  ### Virtual keyboard (experimental)
@@ -196,8 +196,8 @@ To activate start with:
196
196
  scribe --app
197
197
  ```
198
198
  or toggle the app option in the interactive menu. The scribe icon will show, with Record and other options. The icon will change based on what the app is doing. It is possible to choose from a set
199
- of predefined models, or to Quit and choose from the terminal before pressing Enter again.
200
- For the vosk model, there are only two states : recording + transcribing or Idle. For the whisper model there are three states visible from the icon: recording, transcribing and idle/waiting.
199
+ of predefined models (controlled by `--vosk-models` and `whisper-models`) and options, or to Quit and choose from the terminal before pressing Enter again.
200
+ For the vosk model, there are only two states : recording + transcribing or Idle. For the whisper model there are three states visible from the icon: recording/waiting, transcribing and idle.
201
201
  That option requires `pystray` to be installed. This is included with the `pip install ...[all]` option. In Ubuntu the following dependencies were required to make the menus appear:
202
202
 
203
203
  ```bash
@@ -205,6 +205,8 @@ sudo apt install libcairo-dev libgirepository1.0-dev gir1.2-appindicator3-0.1
205
205
  pip install PyGObject
206
206
  ```
207
207
 
208
+ <img src=https://github.com/user-attachments/assets/4c97f4b1-1a65-4d49-9f5a-a9f4287cfa5a width=300px>
209
+
208
210
  ## Start as an application in GNOME
209
211
 
210
212
  If you run Ubuntu (or else?) with GNOME, the script `scribe-install [...]` will create a `scribe.desktop` file and place it under `$HOME/.local/share/applications`
@@ -218,13 +220,10 @@ scribe-install --clipboard --api YOUROPENAIAPIKEY
218
220
  ```
219
221
  (`--api` is optional and only useful if you plan to use `openaiapi` backend later on)
220
222
 
221
- And to make an app running outside the terminal:
222
-
223
+ It is also possible to run an app fully outside the terminal:
223
224
  ```bash
224
- scribe-install --backend openaiapi --name "Scribe App" --keyboard --clipboard --app --no-prompt --no-terminal --api YOUROPENAIAPIKEY
225
+ scribe-install --backend openaiapi --name "Scribe App" --keyboard --clipboard --app --no-prompt --no-terminal --restart-after-silence --api YOUROPENAIAPIKEY --vosk-models vosk-model-fr-0.22 --whisper-models small turbo
225
226
  ```
226
- This will install two separate apps (names "Scribe" and "Scribe App")
227
-
228
227
 
229
228
  ## Fine tuning
230
229
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes