-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_gen_video.py
44 lines (40 loc) · 1.54 KB
/
example_gen_video.py
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
import os
import time
from dotenv import load_dotenv
from VideoGen.config import ManagerConfig, DirectorConfig, InformationConfig, AIConfig, SpeechConfig, SearchConfig
from VideoGen.workers import Manager
from VideoGen.storage import LocalStorage
from VideoGen.tool import ChinaCategory
load_dotenv()
# storage = LocalStorage(os.path.join("output", str(time.time_ns())))
storage = LocalStorage("output/1711214304767606000")
config = ManagerConfig({
"director_config": DirectorConfig({
"use_image_in_webpage": True,
"search_online_image": True,
"use_table_in_webpage": True,
"use_avatar": True,
"use_ocr":True
}),
"information_config": InformationConfig(),
"ai_config": AIConfig({
"type": "AzureOpenAI",
"api_version": "2023-12-01-preview",
"api_key": os.getenv('OPANAI_API_KEY'),
"endpoint": os.getenv('OPANAI_ENDPOINT')
}),
"speech_config": SpeechConfig({
"key": os.getenv('SPEECH_KEY'),
"region": 'southeastasia'
}),
"search_config": SearchConfig({
"bing_search_key": os.getenv('BING_SEARCH_KEY')
})
})
manager = Manager(storage, config)
# news = manager.search.news_category_trending(ChinaCategory.Auto.value)[0]
# webpage_info = manager.information_collector.get_webpage(news['url'])
# script = manager.video_director.webpage2script(webpage_info)
# draft_video = manager.video_director.direct(script, webpage_info.name)
# output_video_info = manager.video_director.export(draft_video)
output_video_info = manager.video_director.export()