2 Star 0 Fork 0

Anning/TextCreateVideo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
cli_demo.py 1.64 KB
一键复制 编辑 原始数据 按行查看 历史
Anning 提交于 2023-08-22 17:51 . no message
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# @author:anning
# @email:anningforchina@gmail.com
# @time:2023/08/01 16:52
# @file:cli_demo.py
import asyncio
from apps.TextSiice.app import Main as TMain
from apps.SpeechSynthesis.app import Main as SMain
from apps.PromptWords.app import Main as PMain
from apps.GeneratePictures.app import Main as GPMain
from apps.GenerateVideo.app import Main as GVMain
# Check if environment variables are present
from config import client_id, client_secret, apikey, appId, ForwardKey, sd_url, file_path
if not all((client_id, client_secret, (all([apikey, appId]), ForwardKey), sd_url, file_path)):
raise ValueError("Environment variables are missing.")
def main(bookname: str, tags: list | None = None):
# 处理文本
t = TMain()
text_list = list(filter(None, t.txt_handle(f'{bookname}.txt')))
print(text_list)
# 生成音频
s = SMain()
audio_list = s.text_to_audio(text_list)
print(audio_list)
# 生成提示词
p = PMain()
object_list = p.create_prompt_words(text_list, tags)
print(object_list)
# 生成图片
gp = GPMain()
picture_path_list = gp.create_picture(object_list)
print(picture_path_list)
# 合并视频
gv = GVMain()
gv.merge_video(picture_path_list, audio_list, bookname)
print("-------视频生成完毕-----------")
print("------- bye -----------")
if __name__ == '__main__':
"""
tags 针对人物或者场景增加手动提示词,支持单或多提示词操作
"""
# tags = {
# "时宇": "年轻男性"
# }
# main("不科学御兽(第一章:御兽时代)")
asyncio.run(main("小说"))
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/An-ning/TextCreateVideo.git
git@gitee.com:An-ning/TextCreateVideo.git
An-ning
TextCreateVideo
TextCreateVideo
main

搜索帮助

0d507c66 1850385 C8b1a773 1850385