Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -25,6 +25,10 @@ def text_to_speech(script):
|
|
25 |
|
26 |
|
27 |
def generate_animation(script):
|
|
|
|
|
|
|
|
|
28 |
lines = script.split('\n')
|
29 |
clips = []
|
30 |
for line in lines:
|
@@ -34,6 +38,7 @@ def generate_animation(script):
|
|
34 |
final_video = concatenate_videoclips(clips)
|
35 |
return final_video
|
36 |
|
|
|
37 |
def generate_sine_wave(frequency, duration, sample_rate=44100, amplitude=0.5):
|
38 |
t = np.linspace(0, duration, int(sample_rate * duration), False)
|
39 |
wave = amplitude * np.sin(2 * np.pi * frequency * t)
|
|
|
25 |
|
26 |
|
27 |
def generate_animation(script):
|
28 |
+
if isinstance(script, list):
|
29 |
+
texts = [item['generated_text'] for item in script if isinstance(item, dict) and 'generated_text' in item]
|
30 |
+
script = " ".join(texts)
|
31 |
+
|
32 |
lines = script.split('\n')
|
33 |
clips = []
|
34 |
for line in lines:
|
|
|
38 |
final_video = concatenate_videoclips(clips)
|
39 |
return final_video
|
40 |
|
41 |
+
|
42 |
def generate_sine_wave(frequency, duration, sample_rate=44100, amplitude=0.5):
|
43 |
t = np.linspace(0, duration, int(sample_rate * duration), False)
|
44 |
wave = amplitude * np.sin(2 * np.pi * frequency * t)
|