Update app.py
Browse files
app.py
CHANGED
@@ -91,15 +91,17 @@ def asr(url):
|
|
91 |
output = openai.ChatCompletion.create(
|
92 |
model="gpt-3.5-turbo",
|
93 |
messages=[
|
94 |
-
{"role": "user",
|
95 |
-
|
|
|
|
|
96 |
)
|
97 |
-
|
98 |
-
|
99 |
|
100 |
-
|
101 |
|
102 |
-
full_translation = "
|
103 |
yield full_translation, full_transcript
|
104 |
|
105 |
title = """
|
|
|
91 |
output = openai.ChatCompletion.create(
|
92 |
model="gpt-3.5-turbo",
|
93 |
messages=[
|
94 |
+
{"role": "user",
|
95 |
+
"content": "Transcript: {transcript}. \n Translate the video conversation transcript into fluent Chinese. Chinese: ".format(transcript=transcript)},
|
96 |
+
],
|
97 |
+
stream=True,
|
98 |
)
|
99 |
+
for event in output:
|
100 |
+
translations.append(event["choices"][0].get("delta", "").get("content", ""))
|
101 |
|
102 |
+
yield "请耐心等候翻译:({}/{})...".format(idx+1, len(transcript_chunks)) + "".join(translations), " ".join(transcripts)
|
103 |
|
104 |
+
full_translation = "".join(translations)
|
105 |
yield full_translation, full_transcript
|
106 |
|
107 |
title = """
|