Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
383732d3
Commit
383732d3
authored
Jul 04, 2021
by
Jean-Baptiste Mardelle
Browse files
Fix speech to text after recent VOSK api change
Fixes #438306
parent
71c58a76
Changes
4
Hide whitespace changes
Inline
Side-by-side
data/scripts/checkvosk.py
100644 → 100755
View file @
383732d3
File mode changed from 100644 to 100755
data/scripts/speech.py
View file @
383732d3
...
@@ -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
],
...
...
data/scripts/speechtotext.py
View file @
383732d3
...
@@ -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
):
...
...
src/dialogs/kdenlivesettingsdialog.cpp
View file @
383732d3
...
@@ -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"
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment