Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -17,18 +17,18 @@ def home():
|
|
17 |
def generate_video():
|
18 |
try:
|
19 |
data = request.get_json()
|
20 |
-
|
21 |
|
22 |
-
if
|
23 |
-
return jsonify({"error": "
|
24 |
image_folder = "/tmp/images"
|
25 |
-
prompts
|
26 |
-
asyncio.run(main(
|
27 |
image_files = sorted(glob.glob(os.path.join(image_folder, "*.jpg")))
|
28 |
if not image_files:
|
29 |
raise ValueError("No images found in folder!")
|
30 |
|
31 |
-
clips = [ImageClip(m).set_duration(
|
32 |
video = concatenate_videoclips(clips, method="compose")
|
33 |
video_path = f"/tmp/video_{uuid.uuid4().hex}.mp4"
|
34 |
video.write_videofile(video_path, fps=24)
|
|
|
17 |
def generate_video():
|
18 |
try:
|
19 |
data = request.get_json()
|
20 |
+
prompts = data.get("duration", '').strip()
|
21 |
|
22 |
+
if prompts == '':
|
23 |
+
return jsonify({"error": "prompts be must"}), 400
|
24 |
image_folder = "/tmp/images"
|
25 |
+
line=prompts.splitlines()
|
26 |
+
asyncio.run(main(lines))
|
27 |
image_files = sorted(glob.glob(os.path.join(image_folder, "*.jpg")))
|
28 |
if not image_files:
|
29 |
raise ValueError("No images found in folder!")
|
30 |
|
31 |
+
clips = [ImageClip(m).set_duration(1) for m in image_files]
|
32 |
video = concatenate_videoclips(clips, method="compose")
|
33 |
video_path = f"/tmp/video_{uuid.uuid4().hex}.mp4"
|
34 |
video.write_videofile(video_path, fps=24)
|