Spaces:
Runtime error
Runtime error
Dy
commited on
Commit
•
e9eaf7f
1
Parent(s):
a1a28a8
Update app.py
Browse files
app.py
CHANGED
@@ -156,6 +156,8 @@ def prompt_to_video(video_prompt):
|
|
156 |
The paragraph in the slides should be formatted in bullet points and each bullet point should be 1.5 line spacing apart.
|
157 |
Header and paragraph should be aligned in an aesthetically pleasing way.
|
158 |
Return the output as a nicely formatted HTML string.
|
|
|
|
|
159 |
Font should be Roboto.
|
160 |
Do not say "Here's your" or "Sure". Directly output the HTML string only.
|
161 |
Make sure there is nothing before or after the HTML string. ONLY output the HTML string.
|
@@ -163,23 +165,24 @@ def prompt_to_video(video_prompt):
|
|
163 |
Do not declare a new variable, output the HTML string only.
|
164 |
'''
|
165 |
html_out_list.append(chatgpt_chain.predict(human_input=prompt_input2))
|
166 |
-
|
167 |
-
|
|
|
168 |
|
169 |
num = 1
|
170 |
for html_string in html_out_list:
|
171 |
print(html_string)
|
172 |
-
with open(f"
|
173 |
file.write(html_string)
|
174 |
num = num + 1
|
175 |
|
176 |
-
|
177 |
|
178 |
# Create the directory to extract to if it doesn't exist
|
179 |
os.makedirs(extract_path, exist_ok=True)
|
180 |
|
181 |
# Configuration for imgkit
|
182 |
-
config = imgkit.config(wkhtmltoimage='C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltoimage.exe')
|
183 |
|
184 |
# The path to store the images
|
185 |
image_path = os.path.join(extract_path, 'images')
|
@@ -271,8 +274,8 @@ def prompt_to_video(video_prompt):
|
|
271 |
|
272 |
|
273 |
# Get list of .jpg and .wav files from the correct directories
|
274 |
-
jpg_files = sorted(glob.glob("
|
275 |
-
wav_files = sorted(glob.glob("
|
276 |
|
277 |
jpg_files, wav_files
|
278 |
|
@@ -303,12 +306,19 @@ def prompt_to_video(video_prompt):
|
|
303 |
# Concatenate all clips into a single video
|
304 |
video = concatenate_videoclips(clips)
|
305 |
|
306 |
-
video_path = "
|
307 |
|
308 |
# Write the video to a file
|
309 |
video.write_videofile(video_path)
|
310 |
|
311 |
|
312 |
return video_path
|
313 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
iface.launch()
|
|
|
156 |
The paragraph in the slides should be formatted in bullet points and each bullet point should be 1.5 line spacing apart.
|
157 |
Header and paragraph should be aligned in an aesthetically pleasing way.
|
158 |
Return the output as a nicely formatted HTML string.
|
159 |
+
Header should be aligned to the center.
|
160 |
+
Font color should be white and background black.
|
161 |
Font should be Roboto.
|
162 |
Do not say "Here's your" or "Sure". Directly output the HTML string only.
|
163 |
Make sure there is nothing before or after the HTML string. ONLY output the HTML string.
|
|
|
165 |
Do not declare a new variable, output the HTML string only.
|
166 |
'''
|
167 |
html_out_list.append(chatgpt_chain.predict(human_input=prompt_input2))
|
168 |
+
|
169 |
+
extract_path = 'slide_' + video_prompt
|
170 |
+
os.makedirs(extract_path, exist_ok=True)
|
171 |
|
172 |
num = 1
|
173 |
for html_string in html_out_list:
|
174 |
print(html_string)
|
175 |
+
with open(f"{extract_path}/slide_{num}.html", "w") as file:
|
176 |
file.write(html_string)
|
177 |
num = num + 1
|
178 |
|
179 |
+
|
180 |
|
181 |
# Create the directory to extract to if it doesn't exist
|
182 |
os.makedirs(extract_path, exist_ok=True)
|
183 |
|
184 |
# Configuration for imgkit
|
185 |
+
#config = imgkit.config(wkhtmltoimage='C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltoimage.exe')
|
186 |
|
187 |
# The path to store the images
|
188 |
image_path = os.path.join(extract_path, 'images')
|
|
|
274 |
|
275 |
|
276 |
# Get list of .jpg and .wav files from the correct directories
|
277 |
+
jpg_files = sorted(glob.glob(f"{extract_path}/images/*.jpg"))
|
278 |
+
wav_files = sorted(glob.glob(f"{extract_path}/*.wav"))
|
279 |
|
280 |
jpg_files, wav_files
|
281 |
|
|
|
306 |
# Concatenate all clips into a single video
|
307 |
video = concatenate_videoclips(clips)
|
308 |
|
309 |
+
video_path = f"{extract_path}/output.mp4"
|
310 |
|
311 |
# Write the video to a file
|
312 |
video.write_videofile(video_path)
|
313 |
|
314 |
|
315 |
return video_path
|
316 |
+
|
317 |
+
iface = gr.Interface(
|
318 |
+
fn=prompt_to_video,
|
319 |
+
inputs="text",
|
320 |
+
outputs=["file"],
|
321 |
+
title="Prompt to Video Tutorial",
|
322 |
+
description="Create a video tutorial to learn about anything!")
|
323 |
+
|
324 |
iface.launch()
|