Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import random
|
| 3 |
+
import time
|
| 4 |
+
|
| 5 |
+
# 假设这是队标的URL或本地路径
|
| 6 |
+
team_logo_url = './team-logo.jpg' # 替换为你的队标图片路径
|
| 7 |
+
|
| 8 |
+
speakers = ["subway"]
|
| 9 |
+
project_intro = """
|
| 10 |
+
## Automatic learning DEMO
|
| 11 |
+
|
| 12 |
+
**atomatic learning是一个训练方式的探索**
|
| 13 |
+
**通过采样视频素材来微调LLM和音色模型**
|
| 14 |
+
尽可能模仿出训练对象的说话语气和音色
|
| 15 |
+
|
| 16 |
+
_训练结果来自嘉然4个视频,时长6小时_
|
| 17 |
+
|
| 18 |
+
项目使用方案
|
| 19 |
+
- **语音**:bert-vits2 - **LLM**:Chat GLM-2
|
| 20 |
+
特别感谢:trochkera开源训练库
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
**注意**
|
| 24 |
+
- 所有文本数据来自视频ASR提取,价值观与基本信息未经人工对齐。所以我们不能对输出结果进行保证
|
| 25 |
+
_(例如她不知道自己是女生还是男生,因为视频未提及。也可能出现LLM的“幻觉”现象)_
|
| 26 |
+
- 所用的BERT-VITS2版本缘故,项目暂时只支持中文
|
| 27 |
+
|
| 28 |
+
项目即将开源,测试完成后率先打包至autodl社区-Code with GPU
|
| 29 |
+
|
| 30 |
+
_我们诚挚地感谢您的支持与反馈。_
|
| 31 |
+
|
| 32 |
+
_feedback email:hhyxnh@gmail_
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
"""
|
| 37 |
+
|
| 38 |
+
with gr.Blocks() as demo:
|
| 39 |
+
with gr.Row():
|
| 40 |
+
with gr.Column(scale=4):
|
| 41 |
+
gr.Image(value=team_logo_url, width=400)
|
| 42 |
+
gr.Markdown(project_intro)
|
| 43 |
+
|
| 44 |
+
with gr.Column(scale=8):
|
| 45 |
+
chatbot = gr.Chatbot()
|
| 46 |
+
msg = gr.Textbox(placeholder="Type your message here...")
|
| 47 |
+
# people_speak = gr.Textbox(value="Human", label="Your name")
|
| 48 |
+
bot_speak = gr.Dropdown(
|
| 49 |
+
choices=speakers, value=speakers[0], label="Speaker"
|
| 50 |
+
)
|
| 51 |
+
with gr.Row():
|
| 52 |
+
submit = gr.Button("Chat!", variant="primary")
|
| 53 |
+
clear = gr.ClearButton([msg, chatbot])
|
| 54 |
+
def respond(people_speak, bot_speak, message, chat_history):
|
| 55 |
+
bot_message = random.choice(["How are you?", "I love you", "I'm very hungry"])
|
| 56 |
+
chat_history.append(( message, bot_speak + ": " + bot_message))
|
| 57 |
+
time.sleep(1)
|
| 58 |
+
return "", chat_history
|
| 59 |
+
|
| 60 |
+
submit.click(respond, inputs=[bot_speak, msg, chatbot], outputs=[msg, chatbot])
|
| 61 |
+
|
| 62 |
+
if __name__ == "__main__":
|
| 63 |
+
demo.launch(server_port=6006)
|