Spaces:
Paused
Paused
Commit
•
d62b28a
1
Parent(s):
95a9653
fix respond bug
Browse files- discourse.py +8 -2
discourse.py
CHANGED
@@ -11,6 +11,7 @@ DATA_FILE = os.path.join("data", DATA_FILENAME)
|
|
11 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
12 |
|
13 |
LANGUAGE = "nl"
|
|
|
14 |
|
15 |
repo = Repository(
|
16 |
local_dir="data", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN
|
@@ -57,6 +58,11 @@ def respond(audio:str):
|
|
57 |
response = gen_response("gpt-3.5-turbo", context)
|
58 |
context.append(response)
|
59 |
|
60 |
-
gen_voice(response,
|
61 |
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
11 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
12 |
|
13 |
LANGUAGE = "nl"
|
14 |
+
AUDIO_FILE_NAME = "audio_response.wav"
|
15 |
|
16 |
repo = Repository(
|
17 |
local_dir="data", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN
|
|
|
58 |
response = gen_response("gpt-3.5-turbo", context)
|
59 |
context.append(response)
|
60 |
|
61 |
+
gen_voice(response, AUDIO_FILE_NAME)
|
62 |
|
63 |
+
transcript = ""
|
64 |
+
for m in context:
|
65 |
+
if m["role"] != "system":
|
66 |
+
transcript += m["role"] + " : " + m["text"] + "\n\n"
|
67 |
+
|
68 |
+
return AUDIO_FILE_NAME, transcript
|