-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
51 lines (41 loc) · 1.49 KB
/
main.py
File metadata and controls
51 lines (41 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import os
import sys
import argparse
from dotenv import load_dotenv
from flow import create_flow
load_dotenv()
def main():
parser = argparse.ArgumentParser(description="Turn markdown articles into animated cartoon videos with AI")
parser.add_argument("input", help="Path to the input markdown file")
parser.add_argument("-o", "--output", default="./output", help="Output directory (default: ./output)")
parser.add_argument("--ref-image", default=None, help="Path to character reference image (default: assets/ref.png)")
args = parser.parse_args()
if not os.path.exists(args.input):
print(f"File not found: {args.input}")
sys.exit(1)
ref_image = args.ref_image or os.path.join(os.path.dirname(__file__), "assets", "ref.png")
if not os.path.exists(ref_image):
print(f"Reference image not found: {ref_image}")
sys.exit(1)
output_dir = os.path.abspath(args.output)
os.makedirs(output_dir, exist_ok=True)
shared = {
"md_path": args.input,
"md_content": "",
"output_dir": output_dir,
"ref_image": ref_image,
"scenes": [],
"scripts": [],
"images": [],
"audios": [],
"videos": [],
"final_video": "",
"current_idx": 0,
}
print(f"Starting pipeline for: {args.input}")
print(f"Output directory: {output_dir}")
flow = create_flow()
flow.run(shared)
print(f"\nDone! Final video: {shared['final_video']}")
if __name__ == "__main__":
main()