Skip to content

Commit

Permalink
feat:对接 AniTalker gradio API;删除旧版quart库实现的版本
Browse files Browse the repository at this point in the history
  • Loading branch information
Ikaros-521 committed Aug 1, 2024
1 parent acc1129 commit 036ca1f
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 267 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- [Sadtalker](https://github.com/OpenTalker/SadTalker)(gradio API,整合包:[夸克网盘](https://pan.quark.cn/s/936dcae8aba0#/list/share/56a79e143a8b4877a98a61854e07b229-AI%20Vtuber/741f94606e414157b8d0a021d3a9ca77-%E8%99%9A%E6%8B%9F%E8%BA%AB%E4%BD%93/6ea2ecc2b19e49c4b1eda383a6aab194-Sadtalker), [迅雷云盘](https://pan.xunlei.com/s/VNitDF0Y3l-qwTpE0A5Rh4DaA1)
- [GeneFacePlusPlus](https://github.com/yerfor/GeneFacePlusPlus)(gradio API,使用的B站:眠NEON 提供的整合包:[视频传送门](https://www.bilibili.com/video/BV1vz421R7ot)
- [MuseTalk](https://github.com/TMElyralab/MuseTalk)(gradio API,整合包:)
- [AniTalker](https://github.com/X-LANCE/AniTalker)(gradio API,使用的B站:刘悦的技术博客 提供的整合包:[下载](https://pan.quark.cn/s/936dcae8aba0#/list/share/56a79e143a8b4877a98a61854e07b229-AI%20Vtuber/741f94606e414157b8d0a021d3a9ca77-%E8%99%9A%E6%8B%9F%E8%BA%AB%E4%BD%93/d31da81a7d64488d812ead76d3bc9f9c-AniTalker), [视频传送门](https://www.bilibili.com/video/BV1rS421N71b)

## 环境
python:3.10.10
Expand Down Expand Up @@ -97,6 +98,10 @@ python:3.10.10

# 更新日志

- v0.2.2
- 对接 AniTalker gradio API(gradio_client版本要求1.2.0及以上)
- 删除旧版quart库实现的版本

- v0.2.1
- 规范化API实现

Expand Down
265 changes: 0 additions & 265 deletions api_server_quart.py

This file was deleted.

6 changes: 6 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,11 @@
"api_ip_port": "http://127.0.0.1:7860",
"video_path": "E:\\GitHub_pro\\digital_human_video_player\\static\\videos\\3.mp4",
"bbox_shift": 0
},
"anitalker": {
"api_ip_port": "http://127.0.0.1:7860",
"img_file": "E:\\GitHub_pro\\digital_human_video_player\\static\\imgs\\2.png",
"is_mor": false,
"face_d": 0
}
}
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# quart
selenium
gradio_client==0.16.3
gradio_client==1.2.0
colorlog
fastapi
2 changes: 1 addition & 1 deletion requirements_common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fsspec==2024.2.0
future==1.0.0
gevent==24.2.1
gevent-websocket==0.10.1
gradio_client==0.16.3
gradio_client==1.2.0
greenlet==3.0.3
h11==0.14.0
h2==4.1.0
Expand Down
12 changes: 12 additions & 0 deletions tests/anitalker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# gradio_client==1.2.0
from gradio_client import Client, handle_file

client = Client("http://127.0.0.1:7860/")
result = client.predict(
face=handle_file('C:\\Users\\Administrator\\Pictures\\test\\1.png'),
audio=handle_file('C:\\Users\\Administrator\\Pictures\\test\\2.mp3'),
is_mor=False,
face_d="0",
api_name="/do_cloth"
)
print(result["video"])
16 changes: 16 additions & 0 deletions utils/video_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,22 @@ def get_video(type: str, data: dict, config: dict):
logging.info(f'{type}合成成功,生成在:{result[0]["video"]}')

return result[0]["video"]
elif type == "anitalker":
# gradio_client-1.2.0
from gradio_client import handle_file

client = Client(config.get("anitalker", "api_ip_port"))
result = client.predict(
face=handle_file(config.get("anitalker", "img_file")), # 图片路径,1:1像素比
audio=handle_file(data['audio_path']),
is_mor=config.get("anitalker", "is_mor"), # 视频超分,0为关闭,1为开启
face_d=config.get("anitalker", "face_d"), # 面部朝向,0为正面,0.25为侧面
api_name="/do_cloth"
)

logging.info(f'{type}合成成功,生成在:{result["video"]}')

return result["video"]
elif type == "local":
return data['video_path']
except Exception as e:
Expand Down

0 comments on commit 036ca1f

Please sign in to comment.