coqui-ai / stt-model-manager

Coqui STT Model Manager - install, manage and try out Coqui STT models from the Model Zoo
https://coqui.ai
Mozilla Public License 2.0
24 stars 17 forks source link

Add proper output management #42

Closed wasertech closed 2 years ago

wasertech commented 2 years ago

https://github.com/coqui-ai/stt-model-manager/blob/390fed9ca8245be6ffae38b731a69d0ec4f14a82/coqui_stt_model_manager/modelmanager.py#L179

We shouldn't print this here it quickly becomes a mess when you have lots of models.

>>> from coqui_stt_model_manager.modelmanager import ModelCard, ModelManager
>>> manager = ModelManager()
Installed models: ModelIndex(models=[ModelCard(name='French STT v0.9', language=
'French', version='v0.9', creator='commonvoice-fr', acoustic='https://coqui.gate
way.scarf.sh/french/commonvoice-fr/v0.9/model.tflite', scorer='https://coqui.gat
eway.scarf.sh/french/commonvoice-fr/v0.9/kenlm.scorer', installed=False, acousti
c_path=None, scorer_path=None), ModelCard(name='Welsh STT v21.03', language='Wel
sh', version='v21.03', creator='Dewi Bryn Jones', acoustic='https://coqui.gatewa
y.scarf.sh/welsh/techiaith/v21.03/model.tflite', scorer='https://coqui.gateway.s
carf.sh/welsh/techiaith/v21.03/techiaith_bangor_transcribe_21.03.scorer', instal
led=False, acoustic_path=None, scorer_path=None), ModelCard(name='Catalan STT v0
.14.0', language='Catalan', version='v0.14.0', creator="Ciaran O'Reilly", acoust
ic='https://coqui.gateway.scarf.sh/catalan/ccoreilly/v0.14.0/model.tflite', scor
er='https://coqui.gateway.scarf.sh/catalan/ccoreilly/v0.14.0/kenlm-aina-3-p10.sc
orer', installed=False, acoustic_path=None, scorer_path=None), ModelCard(name='U
krainian STT v0.4', language='Ukrainian', version='v0.4', creator='Yurii Paniv',
 acoustic='https://coqui.gateway.scarf.sh/ukrainian/robinhad/v0.4/model.tflite',
 scorer='https://coqui.gateway.scarf.sh/ukrainian/robinhad/v0.4/kenlm.scorer', i
nstalled=False, acoustic_path=None, scorer_path=None), ModelCard(name='German ST
T v0.9.0', language='German', version='v0.9.0', creator='Aashish Agarwal', acous
tic='https://coqui.gateway.scarf.sh/german/AASHISHAG/v0.9.0/model.tflite', score
r='https://coqui.gateway.scarf.sh/german/AASHISHAG/v0.9.0/de-aashishag-1-prune-k
enlm.scorer', installed=False, acoustic_path=None, scorer_path=None), ModelCard(
name='Italian STT 2020.8.7', language='Italian', version='2020.8.7', creator='Mo
zilla Italia', acoustic='https://coqui.gateway.scarf.sh/italian/mozillaitalia/20
20.8.7/model.tflite', scorer='https://coqui.gateway.scarf.sh/italian/mozillaital
ia/2020.8.7/it-mzit-1-prune-kenlm.scorer', installed=False, acoustic_path=None, 
scorer_path=None), ModelCard(name='Greek STT v0.1.0', language='Greek', version=
'v0.1.0', creator='ITML', acoustic='https://coqui.gateway.scarf.sh/greek/itml/v0
.1.0/model.tflite', scorer='https://coqui.gateway.scarf.sh/greek/itml/v0.1.0/Gre
ek-digits-yesno.scorer', installed=False, acoustic_path=None, scorer_path=None),
 ModelCard(name='Irish STT v0.1.1', language='Irish', version='v0.1.1', creator=
'ITML', acoustic='https://coqui.gateway.scarf.sh/irish/itml/v0.1.1/model.tflite'
, scorer='https://coqui.gateway.scarf.sh/irish/itml/v0.1.1/Irish-digits-yesno.sc
orer', installed=False, acoustic_path=None, scorer_path=None), ModelCard(name='B
reton STT v0.1.0', language='Breton', version='v0.1.0', creator='ITML', acoustic
='https://coqui.gateway.scarf.sh/breton/itml/v0.1.0/model.tflite', scorer='https
://coqui.gateway.scarf.sh/breton/itml/v0.1.0/Breton-digits-yesno.scorer', instal
led=False, acoustic_path=None, scorer_path=None), ModelCard(name='Polish STT v0.
0.1', language='Polish', version='v0.0.1', creator='Jaco-Assistant', acoustic='h
ttps://coqui.gateway.scarf.sh/polish/jaco-assistant/v0.0.1/model.tflite', scorer
='https://coqui.gateway.scarf.sh/polish/jaco-assistant/v0.0.1/kenlm_pl.scorer', 
installed=False, acoustic_path=None, scorer_path=None), ModelCard(name='English 
STT v1.0.0-huge-vocab', language='English', version='v1.0.0-huge-vocab', creator
='Coqui', acoustic='https://coqui.gateway.scarf.sh/english/coqui/v1.0.0-huge-voc
ab/model.tflite', scorer='https://coqui.gateway.scarf.sh/english/coqui/v1.0.0-hu
ge-vocab/huge-vocabulary.scorer', installed=False, acoustic_path=None, scorer_pa
th=None), ModelCard(name='Russian STT v0.1.0', language='Russian', version='v0.1
.0', creator='Joe Meyer', acoustic='https://coqui.gateway.scarf.sh/russian/jemey
er/v0.1.0/model.tflite', scorer='https://coqui.gateway.scarf.sh/russian/jemeyer/
v0.1.0/wiki-ru-6gram.scorer', installed=False, acoustic_path=None, scorer_path=N
one)])

We can :

  1. Use some repr to make the print prettier
  2. Add a logger to lower this output to debug level only.
wasertech commented 2 years ago

45 takes care of this but I still can add repr that would be sweet.

wasertech commented 2 years ago
❯ stt-model-manager
INFO:engineio.server:Server initialized for threading.
DEBUG:root:Installed models:
DEBUG:root:French/commonvoice-fr/v0.8/French STT v0.8
 * Serving Flask app 'coqui_stt_model_manager.server' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): 127.0.0.1:38450
Current installs: []
DEBUG:urllib3.connectionpool:http://127.0.0.1:38450 "GET / HTTP/1.1" 200 3253
Started server listening on http://127.0.0.1:38450 ...
Ouverture dans une session de navigateur existante.
Current installs: []

Now it does.

wasertech commented 2 years ago

So much better when you can hide the output 😍

>>> import logging
>>> logging.basicConfig(level=logging.INFO)
>>> from coqui_stt_model_manager.modelmanager import ModelCard, ModelManager
>>> manager = ModelManager()
>>>