Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
cjyaddone committed Dec 18, 2022
1 parent c94af8e commit 6bd8854
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
11 changes: 7 additions & 4 deletions ChatWaifuCNVoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ def voice_input():
a = json.loads(rec.Result())
a = str(a['text'])
a = ''.join(a.split())
print(a)
user_input = a
return user_input
if(len(a) > 0):
print(a)
user_input = a
return user_input
if dump_fn is not None:
dump_fn.write(data)

Expand Down Expand Up @@ -421,10 +422,12 @@ def voice_conversion():
print(idmessage)
peaker_id = input()
while True:
resp = api.send_message(voice_input())
voice = voice_input()
resp = api.send_message(voice)
answer = resp["message"].replace('\n','')
print("ChatGPT:")
print(answer)
generateSound("[ZH]"+answer+"[ZH]")
PlaySound(r'.\output.wav', flags=0)
voice = ""

10 changes: 6 additions & 4 deletions ChatWaifuJPVoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,10 @@ def voice_input():
a = json.loads(rec.Result())
a = str(a['text'])
a = ''.join(a.split())
print(a)
user_input = a + " 使用日本语"
return user_input
if(len(a) > 0):
print(a)
user_input = a + " 使用日本语"
return user_input
if dump_fn is not None:
dump_fn.write(data)

Expand Down Expand Up @@ -424,7 +425,8 @@ def voice_conversion():
print(idmessage)
peaker_id = input()
while True:
resp = api.send_message(voice_input())
voice = voice_input()
resp = api.send_message(voice)
answer = resp["message"].replace('\n','')
print("ChatGPT:")
print(answer)
Expand Down
7 changes: 4 additions & 3 deletions ChatWaifuJPVoiceEN.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,10 @@ def voice_input():
a = json.loads(rec.Result())
a = str(a['text'])
a = ''.join(a.split())
print(a)
user_input = a + " 使用日本语"
return user_input
if(len(a) > 0):
print(a)
user_input = a + " 使用日本语"
return user_input
if dump_fn is not None:
dump_fn.write(data)

Expand Down
7 changes: 4 additions & 3 deletions ChatWaifuJPVoiceJP.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,10 @@ def voice_input():
a = json.loads(rec.Result())
a = str(a['text'])
a = ''.join(a.split())
print(a)
user_input = a + " 使用日本语"
return user_input
if(len(a) > 0):
print(a)
user_input = a + " 使用日本语"
return user_input
if dump_fn is not None:
dump_fn.write(data)

Expand Down

0 comments on commit 6bd8854

Please sign in to comment.