[Image] file saved along side the corresponding audio file.
This commit is contained in:
parent
d3d540577e
commit
5cedbec10f
|
@ -51,7 +51,7 @@ def play_audio(text):
|
|||
stream(audio)
|
||||
return
|
||||
|
||||
# Save the audio to a file and play it
|
||||
# Save the audio to a file
|
||||
unique_id = base64.urlsafe_b64encode(os.urandom(30)).decode("utf-8").rstrip("=")
|
||||
dir_path = os.path.join("narration", unique_id)
|
||||
os.makedirs(dir_path, exist_ok=True)
|
||||
|
@ -60,6 +60,12 @@ def play_audio(text):
|
|||
with open(file_path, "wb") as f:
|
||||
f.write(audio)
|
||||
|
||||
# Copy the image analyzed to the same directory as the audio file
|
||||
image_path = os.path.join(os.getcwd(), "./frames/frame.jpg")
|
||||
new_image_path = os.path.join(dir_path, "image.jpg")
|
||||
os.system(f"cp {image_path} {new_image_path}")
|
||||
|
||||
# Play the audio
|
||||
play(audio)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue