Spaces:
Sleeping
Sleeping
Prudvireddy
commited on
Update tools.py
Browse files
tools.py
CHANGED
@@ -83,7 +83,7 @@ def generate_speech(text, speech_dir='./outputs/audio', lang='en', speed=170, vo
|
|
83 |
|
84 |
engine.setProperty('voice', voice_id)
|
85 |
engine.setProperty('rate', speed)
|
86 |
-
os.remove(os.path.join(os.path.dirname(os.path.abspath(__file__)), speech_dir, f'speech_{num}.mp3')) if os.path.exists(os.path.join(speech_dir, f'speech_{num}.mp3')) else None
|
87 |
engine.save_to_file(text, os.path.join(os.path.dirname(os.path.abspath(__file__)), speech_dir, f'speech_{num}.mp3'))
|
88 |
engine.runAndWait()
|
89 |
|
@@ -371,7 +371,7 @@ def image_generator(script):
|
|
371 |
Saves it to images_dir and return path
|
372 |
Args:
|
373 |
script: a complete script containing narrations and image descriptions"""
|
374 |
-
images_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), './outputs/images')
|
375 |
os.makedirs(images_dir, exist_ok=True)
|
376 |
# if num==1:
|
377 |
for filename in os.listdir(images_dir):
|
|
|
83 |
|
84 |
engine.setProperty('voice', voice_id)
|
85 |
engine.setProperty('rate', speed)
|
86 |
+
# os.remove(os.path.join(os.path.dirname(os.path.abspath(__file__)), speech_dir, f'speech_{num}.mp3')) if os.path.exists(os.path.join(speech_dir, f'speech_{num}.mp3')) else None
|
87 |
engine.save_to_file(text, os.path.join(os.path.dirname(os.path.abspath(__file__)), speech_dir, f'speech_{num}.mp3'))
|
88 |
engine.runAndWait()
|
89 |
|
|
|
371 |
Saves it to images_dir and return path
|
372 |
Args:
|
373 |
script: a complete script containing narrations and image descriptions"""
|
374 |
+
# images_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), './outputs/images')
|
375 |
os.makedirs(images_dir, exist_ok=True)
|
376 |
# if num==1:
|
377 |
for filename in os.listdir(images_dir):
|