play video
Browse filesFiles changed (5)
- Qwen/42.pngDeleted
- Qwen/run.py+39-20
- face_input/input_video.mp4Deleted-3
- wav_generate/response.wavDeleted
- wav_output/input_audio.wavAdded
8 unmodified lines9101112131413 unmodified lines28293031323378 unmodified lines11211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214310 unmodified lines15415515615715815916016116216316 unmodified lines18018118218318418525 unmodified lines21121221321421521645 unmodified lines2622632642652662672686 unmodified lines2752762772782792802818 unmodified linesimport asyncioimport edge_ttsimport base64# 获取当前脚本所在的目录current_dir = os.path.dirname(os.path.abspath(__file__))13 unmodified linesVOLUME = "-10%" # 降低音量10%OUTPUT_FILE = os.path.join(wav_output_dir, "input_audio.wav") # 音频文件名def _get_args():parser = ArgumentParser()78 unmodified linesif torch.cuda.is_available():torch.cuda.empty_cache()cheetah = os.path.join(os.path.dirname(__file__), "42.png")my_css = """body {background: linear-gradient(to right, #ece9e6, #ffffff); /* 背景渐变 */font-family: 'Arial Rounded MT Bold', sans-serif; /* 字体 */}#healthy_img {width: 1032px;height: 480px;transition: transform 0.5s;display: block;margin-left: auto;margin-right: auto;margin-top: 0;}#qwen-chat-container {box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);transition: 0.3s;border-radius: 5px;background-color: #f9f9f9;padding: 20px;}.gr-button {border-radius: 20px;padding: 10px 20px;10 unmodified linestransform: scale(1.05);}.control-height {min-height: 500px;}textarea.gr-textbox {font-family: 'Arial Rounded MT Bold', sans-serif;}16 unmodified linesanimation: popIn 2s ease;}@keyframes fadeIn {from { opacity: 0; }to { opacity: 1; }25 unmodified linesdef _launch_demo(args, model, tokenizer, config):def predict(_query, _chatbot, _task_history):_chatbot.append((_parse_text(_query), ""))full_response = ""45 unmodified lines</center>""")chatbot = gr.Chatbot(label='Qwen-Chat', elem_id="qwen-chat-container")query = gr.Textbox(lines=2, label='请输入您的问题', placeholder="开始对话...")task_history = gr.State([])6 unmodified linessubmit_btn.click(reset_user_input, [], [query])empty_btn.click(reset_state, [chatbot, task_history], outputs=[chatbot], show_progress=True)regen_btn.click(regenerate, [chatbot, task_history], [chatbot], show_progress=True)gr.Image(type="pil", value=cheetah, elem_id="healthy_img")demo.queue().launch(share=args.share,8 unmodified lines910111213141513 unmodified lines29303132333435363738394041424344454678 unmodified lines12512612712812913013113213313413513613713813914014114214310 unmodified lines15415515615715815916 unmodified lines17617717817918018118218318418518618718818919019119219325 unmodified lines21922022122222322422522622722822923023123223345 unmodified lines2792802812822832842852862872886 unmodified lines2952962972982993008 unmodified linesimport asyncioimport edge_ttsimport base64import time# 获取当前脚本所在的目录current_dir = os.path.dirname(os.path.abspath(__file__))13 unmodified linesVOLUME = "-10%" # 降低音量10%OUTPUT_FILE = os.path.join(wav_output_dir, "input_audio.wav") # 音频文件名#创建default_video文件夹路径default_video_dir = os.path.join(parent_dir, 'default_video')if not os.path.exists(default_video_dir):os.makedirs(default_video_dir)OUTPUT_DEFAULT_VIDEO=os.path.join(default_video_dir, "default.mp4") # 默认视频文件名# 待播放视频的路径response_video_dir = os.path.join(parent_dir, 'response')if not os.path.exists(response_video_dir):os.makedirs(response_video_dir)RESPONSE_VIDEO=os.path.join(response_video_dir, "output.mp4") # 生成视频文件名def _get_args():parser = ArgumentParser()78 unmodified linesif torch.cuda.is_available():torch.cuda.empty_cache()my_css = """body {background: linear-gradient(to right, #ece9e6, #ffffff); /* 背景渐变 */font-family: 'Arial Rounded MT Bold', sans-serif; /* 字体 */}#qwen-chat-container {box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);transition: 0.3s;border-radius: 5px;background-color: #f9f9f9;padding: 10px;}.gr-button {border-radius: 20px;padding: 10px 20px;10 unmodified linestransform: scale(1.05);}textarea.gr-textbox {font-family: 'Arial Rounded MT Bold', sans-serif;}16 unmodified linesanimation: popIn 2s ease;}#video-container {display: flex;justify-content: center;}#default-video {width: 450px;height: 800px;display: block;margin: auto;}@keyframes fadeIn {from { opacity: 0; }to { opacity: 1; }25 unmodified linesdef _launch_demo(args, model, tokenizer, config):def predict(_query, _chatbot, _task_history):global new_video_path# 在处理用户输入的同时生成或更新新视频文件路径# 假设视频生成逻辑在这里执行,并且生成视频存储在 new_video_path#new_video_path = "output.mp4" # 您的生成新视频逻辑#video.update(value=new_video_path)_chatbot.append((_parse_text(_query), ""))full_response = ""45 unmodified lines</center>""")# 添加视频播放组件video = gr.Video(value=OUTPUT_DEFAULT_VIDEO, format="mp4", label="默认视频", elem_id="default-video")chatbot = gr.Chatbot(label='Qwen-Chat', elem_id="qwen-chat-container",height=180)query = gr.Textbox(lines=2, label='请输入您的问题', placeholder="开始对话...")task_history = gr.State([])6 unmodified linessubmit_btn.click(reset_user_input, [], [query])empty_btn.click(reset_state, [chatbot, task_history], outputs=[chatbot], show_progress=True)regen_btn.click(regenerate, [chatbot, task_history], [chatbot], show_progress=True)demo.queue().launch(share=args.share,
123version https://git-lfs.github.com/spec/v1oid sha256:e36bef638b04f320377d894aedc7d41c88c5bd115ab93fe0fe80317e5b91a5ebsize 738224Qwen/42.pngDeleted
Qwen/run.py+39-20
face_input/input_video.mp4Deleted-3
wav_generate/response.wavDeleted
wav_output/input_audio.wavAdded