Commit 383732d3 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix speech to text after recent VOSK api change

Fixes #438306
parent 71c58a76
File mode changed from 100644 to 100755
...@@ -23,6 +23,7 @@ if not os.path.exists(sys.argv[2]): ...@@ -23,6 +23,7 @@ if not os.path.exists(sys.argv[2]):
sample_rate=16000 sample_rate=16000
model = Model(sys.argv[2]) model = Model(sys.argv[2])
rec = KaldiRecognizer(model, sample_rate) rec = KaldiRecognizer(model, sample_rate)
rec.SetWords(True)
process = subprocess.Popen(['ffmpeg', '-loglevel', 'quiet', '-i', process = subprocess.Popen(['ffmpeg', '-loglevel', 'quiet', '-i',
sys.argv[3], sys.argv[3],
......
...@@ -22,6 +22,7 @@ if not os.path.exists(sys.argv[2]): ...@@ -22,6 +22,7 @@ if not os.path.exists(sys.argv[2]):
sample_rate=16000 sample_rate=16000
model = Model(sys.argv[2]) model = Model(sys.argv[2])
rec = KaldiRecognizer(model, sample_rate) rec = KaldiRecognizer(model, sample_rate)
rec.SetWords(True)
# zone rendering # zone rendering
if len(sys.argv) > 4 and (float(sys.argv[4])>0 or float(sys.argv[5])>0): if len(sys.argv) > 4 and (float(sys.argv[4])>0 or float(sys.argv[5])>0):
......
...@@ -1890,8 +1890,10 @@ void KdenliveSettingsDialog::checkVoskDependencies() ...@@ -1890,8 +1890,10 @@ void KdenliveSettingsDialog::checkVoskDependencies()
{ {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
QString pyExec = QStandardPaths::findExecutable(QStringLiteral("python")); QString pyExec = QStandardPaths::findExecutable(QStringLiteral("python"));
QString pip3Exec = QStandardPaths::findExecutable(QStringLiteral("pip"));
#else #else
QString pyExec = QStandardPaths::findExecutable(QStringLiteral("python3")); QString pyExec = QStandardPaths::findExecutable(QStringLiteral("python3"));
QString pip3Exec = QStandardPaths::findExecutable(QStringLiteral("pip3"));
#endif #endif
if (pyExec.isEmpty()) { if (pyExec.isEmpty()) {
doShowSpeechMessage(i18n("Cannot find python3, please install it on your system."), KMessageWidget::Warning); doShowSpeechMessage(i18n("Cannot find python3, please install it on your system."), KMessageWidget::Warning);
...@@ -1928,7 +1930,7 @@ void KdenliveSettingsDialog::checkVoskDependencies() ...@@ -1928,7 +1930,7 @@ void KdenliveSettingsDialog::checkVoskDependencies()
} else { } else {
if (m_speechListWidget->count() == 0) { if (m_speechListWidget->count() == 0) {
doShowSpeechMessage(i18n("Please add a speech model."), KMessageWidget::Information); doShowSpeechMessage(i18n("Please add a speech model."), KMessageWidget::Information);
} else { } else if (!pip3Exec.isEmpty()) {
if (!m_voskUpdated) { if (!m_voskUpdated) {
// only allow upgrading python modules once // only allow upgrading python modules once
m_voskAction->setText(i18n("Check for update")); m_voskAction->setText(i18n("Check for update"));
...@@ -1942,7 +1944,7 @@ void KdenliveSettingsDialog::checkVoskDependencies() ...@@ -1942,7 +1944,7 @@ void KdenliveSettingsDialog::checkVoskDependencies()
} else { } else {
if (m_speechListWidget->count() == 0) { if (m_speechListWidget->count() == 0) {
doShowSpeechMessage(i18n("Please add a speech model."), KMessageWidget::Information); doShowSpeechMessage(i18n("Please add a speech model."), KMessageWidget::Information);
} else { } else if (!pip3Exec.isEmpty()) {
if (!m_voskUpdated) { if (!m_voskUpdated) {
// only allow upgrading python modules once // only allow upgrading python modules once
m_voskAction->setText(i18n("Check for update")); m_voskAction->setText(i18n("Check for update"));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment