Wrap label text. Set default to base.
This commit is contained in:
@@ -40,7 +40,7 @@ class STTVoiceMessagesPlugin(GajimPlugin):
|
||||
|
||||
self.config_default_values = {
|
||||
'use_multilanguage_model': (True, ''),
|
||||
'model_size': ('tiny', '')
|
||||
'model_size': ('base', '')
|
||||
}
|
||||
|
||||
self._audio_file = None
|
||||
@@ -77,7 +77,11 @@ class STTBox(Gtk.Box):
|
||||
self._audio_file = audio_file
|
||||
|
||||
self._transcribe_button = Gtk.Button(label=_('Transcribe'))
|
||||
self._transcription_label = Gtk.Label(label='Fooo')
|
||||
|
||||
self._transcription_label = Gtk.Label(label=_('Nothing transcribed yet'))
|
||||
self._transcription_label.set_max_width_chars(40)
|
||||
self._transcription_label.set_line_wrap(True)
|
||||
|
||||
self.add(self._transcribe_button)
|
||||
self.add(self._transcription_label)
|
||||
|
||||
@@ -88,7 +92,10 @@ class STTBox(Gtk.Box):
|
||||
|
||||
def _on_transcribe_clicked(self, _button: Gtk.Button):
|
||||
text = self._trascribe_by_whisper()
|
||||
self._transcription_label.set_text(text)
|
||||
if text.strip() != '':
|
||||
self._transcription_label.set_text(text.strip())
|
||||
else:
|
||||
self._transcription_label.set_text(_('_Have not heard any word!_'))
|
||||
|
||||
def _trascribe_by_whisper(self) -> str:
|
||||
model = whisper.load_model(self._config['model_size'])
|
||||
|
||||
Reference in New Issue
Block a user