LiveTalking icon indicating copy to clipboard operation
LiveTalking copied to clipboard

app.py 启动程序里的参数musetalk里的 --avatar_id 这个角色id是否可以 在前台动态能否修改而不需要 重新启动服务器?应该怎么做

Open anstonjie opened this issue 1 year ago • 12 comments

程序里的这个参数 parser.add_argument('--avatar_id', type=str, default='avator_1') 参数 --avatar_id 是否可以动态传递,就是前台可以修改这个参数 而不需要重新启动服务器

anstonjie avatar Dec 25 '24 13:12 anstonjie

你好大佬 把你的代码加入以后 下面的 nerfreals[sessionid].change_avatar(new_avatar) 这个方法找不到,我看你引入了

elif opt.model == 'musetalk': from musereal import MuseReal, load_model, load_avatar, warm_up,change_avatar 但是 musereal 这个类里面也没有这个方法change_avatar 请指导谢谢

async def change_avatar_handler(request): params = await request.json() sessionid = params.get('sessionid', 0) new_avatar_id = params.get('avatar_id') print('new_avatar_id>>>>>',new_avatar_id) if sessionid in nerfreals and new_avatar_id: new_avatar = load_avatar(new_avatar_id) nerfreals[sessionid].change_avatar(new_avatar) return web.Response( content_type="application/json", text=json.dumps({"code": 0, "data": "Avatar changed successfully"}) ) else: return web.Response( content_type="application/json", text=json.dumps({"code": -1, "data": "Invalid session or avatar ID"}) )

anstonjie avatar Dec 25 '24 14:12 anstonjie

@anstonjie LipReal类中添加方法如下: def change_avatar(self, avatar): self.frame_list_cycle, self.face_list_cycle, self.coord_list_cycle = avatar # 当切换数字人形象时,旧形象相关的帧数据不再有用 while not self.res_frame_queue.empty(): try: self.res_frame_queue.get_nowait() except queue.Empty: break logger.info('数字人形象切换完成')

JACKYLUO1991 avatar Dec 30 '24 07:12 JACKYLUO1991

太感谢了

---- 回复的原邮件 ---- | 发件人 | @.> | | 日期 | 2024年12月30日 15:25 | | 收件人 | @.> | | 抄送至 | @.>@.> | | 主题 | Re: [lipku/LiveTalking] app.py 启动程序里的参数musetalk里的 --avatar_id 这个角色id是否可以 在前台动态能否修改而不需要 重新启动服务器?应该怎么做 (Issue #341) |

@anstonjie LipReal类中添加方法如下: def change_avatar(self, avatar): self.frame_list_cycle, self.face_list_cycle, self.coord_list_cycle = avatar

当切换数字人形象时,旧形象相关的帧数据不再有用

while not self.res_frame_queue.empty(): try: self.res_frame_queue.get_nowait() except queue.Empty: break logger.info('数字人形象切换完成')

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

anstonjie avatar Dec 30 '24 07:12 anstonjie

def change_avatar(self, avatar): self.frame_list_cycle, self.face_list_cycle, self.coord_list_cycle = avatar

当切换数字人形象时,旧形象相关的帧数据不再有用

while not self.res_frame_queue.empty(): try: self.res_frame_queue.get_nowait() except queue.Empty: break print('数字人形象切换完成')

我把方法加入

报错为

ERROR:aiohttp.server:Error handling request Traceback (most recent call last): File "D:\ai3\LiveTalking.venv\lib\site-packages\aiohttp\web_protocol.py", line 480, in _handle_request resp = await request_handler(request) File "D:\ai3\LiveTalking.venv\lib\site-packages\aiohttp\web_app.py", line 569, in _handle return await handler(request) File "D:\ai3\LiveTalking\app-two.py", line 244, in change_avatar_handler nerfreals[sessionid].change_avatar(new_avatar) File "D:\ai3\LiveTalking\musereal.py", line 256, in change_avatar self.frame_list_cycle, self.face_list_cycle, self.coord_list_cycle = avatar ValueError: too many values to unpack (expected 3) sleep qsize= 127

anstonjie avatar Dec 30 '24 08:12 anstonjie

兄弟,我按照你这样改完,人可以切换过去了,,,但是嘴巴的渲染还是前一个形象的

bigai-wwb avatar Jan 07 '25 08:01 bigai-wwb

切换完了但是人不动

---- 回复的原邮件 ---- | 发件人 | @.> | | 日期 | 2025年01月07日 16:44 | | 收件人 | @.> | | 抄送至 | @.>@.> | | 主题 | Re: [lipku/LiveTalking] app.py 启动程序里的参数musetalk里的 --avatar_id 这个角色id是否可以 在前台动态能否修改而不需要 重新启动服务器?应该怎么做 (Issue #341) |

兄弟,我按照你这样改完,人可以切换过去了,,,但是嘴巴的渲染还是前一个形象的

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

anstonjie avatar Jan 07 '25 08:01 anstonjie

嘴巴贴合可能需要单独起一个线程

---原始邮件--- 发件人: @.> 发送时间: 2025年1月7日(周二) 下午4:44 收件人: @.>; 抄送: @.@.>; 主题: Re: [lipku/LiveTalking] app.py 启动程序里的参数musetalk里的 --avatar_id 这个角色id是否可以 在前台动态能否修改而不需要 重新启动服务器?应该怎么做 (Issue #341)

兄弟,我按照你这样改完,人可以切换过去了,,,但是嘴巴的渲染还是前一个形象的

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

JACKYLUO1991 avatar Jan 07 '25 08:01 JACKYLUO1991

这个解决了吗?就是动态配置avatar_id这个角色ID

chentiejin1 avatar Jan 16 '25 08:01 chentiejin1

解决了换角色了,但是不知道怎么推流到前台

---- 回复的原邮件 ---- | 发件人 | @.> | | 日期 | 2025年01月16日 16:08 | | 收件人 | @.> | | 抄送至 | @.>@.> | | 主题 | Re: [lipku/LiveTalking] app.py 启动程序里的参数musetalk里的 --avatar_id 这个角色id是否可以 在前台动态能否修改而不需要 重新启动服务器?应该怎么做 (Issue #341) |

这个解决了吗?就是动态配置avatar_id这个角色ID

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

anstonjie avatar Jan 16 '25 13:01 anstonjie

就是换了角色以后页面上显示的角色不动

---- 回复的原邮件 ---- | 发件人 | @.> | | 日期 | 2025年01月16日 16:08 | | 收件人 | @.> | | 抄送至 | @.>@.> | | 主题 | Re: [lipku/LiveTalking] app.py 启动程序里的参数musetalk里的 --avatar_id 这个角色id是否可以 在前台动态能否修改而不需要 重新启动服务器?应该怎么做 (Issue #341) |

这个解决了吗?就是动态配置avatar_id这个角色ID

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

anstonjie avatar Jan 16 '25 13:01 anstonjie

兄弟,我按照你这样改完,人可以切换过去了,,,但是嘴巴的渲染还是前一个形象的

我遇到这个问题如何解决 求大神

agnils avatar Feb 22 '25 03:02 agnils

@agnils ,我昨天在按照本贴修改时,出现了和你一样的状况,render()函数中推理线程仍在运行 Thread(target=inference, args=(quit_event,self.batch_size,self.face_list_cycle, self.asr.feat_queue,self.asr.output_queue,self.res_frame_queue, self.model,)).start() #mp.Process 嘴形推理线程先停下来,再重启线程,让其加载切换后的嘴形

LiuEhe avatar Apr 11 '25 07:04 LiuEhe