sreepathi-ravikumar commited on
Commit
b153e4f
·
verified ·
1 Parent(s): 7c9ccc5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -19,11 +19,8 @@ def home():
19
  def generate_video():
20
  try:
21
  data = request.get_json()
22
- lines = data.get("lines", []) # This will be the list
23
- id = data.get("id", 0) # This will be the integer
24
-
25
- print("Received List:", lines)
26
- print("Received Count:", id)
27
  image_folder = "/tmp/images"
28
  #line=prompts.splitlines()
29
  #asyncio.run(main(line))
@@ -32,18 +29,20 @@ def generate_video():
32
  image_olst=[]
33
  create_text_image(lines[id],id,image_olst)
34
  image_files = sorted(glob.glob(os.path.join(image_folder, "*.png")))
35
- if not image_files:
36
- raise ValueError("No images found in folder!")
37
-
38
  video_path = video_func(id,lines)
39
  for img in image_files:
40
  os.remove(img)
41
 
 
 
 
 
 
42
  return send_file(video_path, mimetype='video/mp4')
43
 
44
  except Exception as e:
45
- traceback.print_exc()
46
  return jsonify({"error": str(e)}), 500
 
47
 
48
  if __name__ == "__main__":
49
  app.run(host="0.0.0.0", port=7860)
 
19
  def generate_video():
20
  try:
21
  data = request.get_json()
22
+ id = data["id"]
23
+ lines = data["lines"]
 
 
 
24
  image_folder = "/tmp/images"
25
  #line=prompts.splitlines()
26
  #asyncio.run(main(line))
 
29
  image_olst=[]
30
  create_text_image(lines[id],id,image_olst)
31
  image_files = sorted(glob.glob(os.path.join(image_folder, "*.png")))
 
 
 
32
  video_path = video_func(id,lines)
33
  for img in image_files:
34
  os.remove(img)
35
 
36
+ # Your existing processing logic
37
+ # create_text_image, video_func, etc.
38
+
39
+ video_path = video_func(id, lines)
40
+
41
  return send_file(video_path, mimetype='video/mp4')
42
 
43
  except Exception as e:
 
44
  return jsonify({"error": str(e)}), 500
45
+
46
 
47
  if __name__ == "__main__":
48
  app.run(host="0.0.0.0", port=7860)