Add prompts to video generation and final message in listening audios.

This commit is contained in:
Cristiano Ferreira
2024-03-19 19:38:09 +00:00
parent 8b83a4163d
commit 274bd79c6a
2 changed files with 24 additions and 2 deletions

8
app.py
View File

@@ -634,7 +634,11 @@ def generate_speaking_video():
try:
data = request.get_json()
avatar = data.get("avatar", random.choice(list(AvatarEnum)).value)
sp1_result = create_video(data["question"], avatar)
prompts = data.get("prompts", [])
question = data.get("question")
if len(prompts) > 0:
question = question + " In your answer you should consider: " + " ".join(prompts)
sp1_result = create_video(question, avatar)
if sp1_result is not None:
sound_file_path = VIDEO_FILES_PATH + sp1_result
firebase_file_path = FIREBASE_SPEAKING_VIDEO_FILES_PATH + sp1_result
@@ -644,7 +648,7 @@ def generate_speaking_video():
return {
"text": data["question"],
"prompts": data["prompts"] if "prompts" in data else [],
"prompts": prompts,
"title": data["topic"],
"video_url": sp1_video_url,
"video_path": sp1_video_path,