Spaces:
Paused
Paused
Update app.py
Browse filesupdated script as per gTTS update
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import gradio as gr
|
|
| 2 |
from transformers import GPT2LMHeadModel, GPT2Tokenizer
|
| 3 |
from diffusers import StableDiffusionPipeline
|
| 4 |
from moviepy.editor import ImageSequenceClip, AudioFileClip, concatenate_videoclips
|
| 5 |
-
import
|
| 6 |
import os
|
| 7 |
|
| 8 |
# Function to generate a script from a text prompt
|
|
@@ -17,11 +17,10 @@ def generate_script(prompt):
|
|
| 17 |
script = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 18 |
return script
|
| 19 |
|
| 20 |
-
# Function to convert text to speech using
|
| 21 |
-
def text_to_speech(text, output_path="output.
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
engine.runAndWait()
|
| 25 |
return output_path
|
| 26 |
|
| 27 |
# Function to generate images from a text prompt using Stable Diffusion
|
|
|
|
| 2 |
from transformers import GPT2LMHeadModel, GPT2Tokenizer
|
| 3 |
from diffusers import StableDiffusionPipeline
|
| 4 |
from moviepy.editor import ImageSequenceClip, AudioFileClip, concatenate_videoclips
|
| 5 |
+
from gtts import gTTS
|
| 6 |
import os
|
| 7 |
|
| 8 |
# Function to generate a script from a text prompt
|
|
|
|
| 17 |
script = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 18 |
return script
|
| 19 |
|
| 20 |
+
# Function to convert text to speech using gTTS
|
| 21 |
+
def text_to_speech(text, output_path="output.mp3"):
|
| 22 |
+
tts = gTTS(text=text, lang='en')
|
| 23 |
+
tts.save(output_path)
|
|
|
|
| 24 |
return output_path
|
| 25 |
|
| 26 |
# Function to generate images from a text prompt using Stable Diffusion
|