Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ import glob
|
|
6 |
import os
|
7 |
import asyncio
|
8 |
from image_fetcher import main
|
|
|
9 |
|
10 |
app = Flask(__name__)
|
11 |
|
@@ -22,9 +23,25 @@ def generate_video():
|
|
22 |
if prompts == '':
|
23 |
return jsonify({"error": "prompts be must"}), 400
|
24 |
image_folder = "/tmp/images"
|
25 |
-
line=prompts.splitlines()
|
26 |
-
asyncio.run(main(line))
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
if not image_files:
|
29 |
raise ValueError("No images found in folder!")
|
30 |
|
|
|
6 |
import os
|
7 |
import asyncio
|
8 |
from image_fetcher import main
|
9 |
+
from video import create_text_image
|
10 |
|
11 |
app = Flask(__name__)
|
12 |
|
|
|
23 |
if prompts == '':
|
24 |
return jsonify({"error": "prompts be must"}), 400
|
25 |
image_folder = "/tmp/images"
|
26 |
+
#line=prompts.splitlines()
|
27 |
+
#asyncio.run(main(line))
|
28 |
+
lines=[]
|
29 |
+
words=prompts.split()
|
30 |
+
word_count=30
|
31 |
+
for i in range(0,int(len(words)/word_count)):
|
32 |
+
line=""
|
33 |
+
for j in range(i*word_count,(i*word_count)+word_count):
|
34 |
+
line=line+words[j]+" "
|
35 |
+
lines.append(line)
|
36 |
+
line=""
|
37 |
+
for l in range((int(len(words)/word_count))*word_count,len(words)):
|
38 |
+
line=line+words[l]+" "
|
39 |
+
lines.append(line)
|
40 |
+
image_olst=[]
|
41 |
+
for id in range(len(lines)):
|
42 |
+
create_text_image(lines[id],id*2,image_olst)
|
43 |
+
print(image_olst)
|
44 |
+
image_files = sorted(glob.glob(os.path.join(image_folder, "*.png")))
|
45 |
if not image_files:
|
46 |
raise ValueError("No images found in folder!")
|
47 |
|