Открыть боковую панель
yarburart
keai
Коммиты
0af05065
Коммит
0af05065
создал
Апр 06, 2023
по автору
YarBurArt
Просмотр файлов
doc code
владелец
f3d3eb35
Изменения
1
Скрыть пробелы
Построчно
Рядом
manager.py
Просмотр файла @
0af05065
...
...
@@ -12,18 +12,25 @@ translator1 = GoogleTranslator(source='en', target='ru')
async
def
check_voice
():
"""
The function which processes the voice over recording in seconds
:return: start app from recognize voice or answer by rei
"""
while
True
:
await
asyncio
.
sleep
(
3
)
if
sec
:
=
input
(
"enter sec:"
):
if
sec
==
"q"
:
break
print
(
'start recording'
)
record_audio
(
int
(
sec
))
print
(
'end recording'
)
await
asyncio
.
sleep
(
0.2
)
text
=
recognize_voice
(
lang
=
'ru'
)
# it's highlighted because it's so beautiful ^_^
with
int
(
sec
)
as
record_sec
:
print
(
'start recording'
)
record_audio
(
record_sec
)
print
(
'end recording'
)
await
asyncio
.
sleep
(
0.2
)
text
=
recognize_voice
(
lang
=
'ru'
)
# edit lang for your region
# this must be added for levenstein distance
if
"питон"
in
text
.
split
(
" "
):
autopc
.
run_devkit
(
"python"
)
if
"плюсы"
in
text
.
split
(
" "
):
...
...
@@ -39,6 +46,7 @@ async def check_voice():
text
=
get_gpt2_text
(
"tell me how is my anime girl: "
+
translated
)
showimg_tk
(
"graphics/r1.png"
,
text
,
ismuz
=
True
)
# set socket parameters for IPC
host
=
socket
.
gethostname
()
port
=
5000
server_socket
=
socket
.
socket
()
...
...
@@ -49,6 +57,10 @@ print("Connection from: " + str(address))
async
def
check_emotion
():
"""
The function that takes the recognized emotion from emorec.py,
recognition in emorec.py must be run in parallel via anaconda
"""
while
True
:
await
asyncio
.
sleep
(
0.5
)
data
=
conn
.
recv
(
1024
).
decode
()
...
...
@@ -60,6 +72,7 @@ async def check_emotion():
text
=
get_gpt2_text
(
"tell me how is my anime girl: hello, i feel happy"
)
showimg_tk
(
"graphics/r1.png"
,
text
,
ismuz
=
True
)
# async loop so REI can see and listen me
loop
=
asyncio
.
get_event_loop
()
cors
=
asyncio
.
wait
([
check_voice
(),
check_emotion
()])
loop
.
run_until_complete
(
cors
)
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать