Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,63 +1,18 @@
|
|
1 |
import gradio as gr
|
2 |
-
import
|
3 |
-
import time
|
4 |
|
|
|
5 |
|
6 |
-
|
7 |
-
|
|
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
尽可能模仿出训练对象的说话语气和音色
|
16 |
-
|
17 |
-
_训练结果来自嘉然4个视频,时长6小时_
|
18 |
-
|
19 |
-
项目使用方案
|
20 |
-
- **语音**:bert-vits2 - **LLM**:Chat GLM-2
|
21 |
-
特别感谢:trochkera开源训练库
|
22 |
-
|
23 |
-
|
24 |
-
**注意**
|
25 |
-
- 所有文本数据来自视频ASR提取,价值观与基本信息未经人工对齐。所以我们不能对输出结果进行保证
|
26 |
-
_(例如她不知道自己是女生还是男生,因为视频未提及。也可能出现LLM的“幻觉”现象)_
|
27 |
-
- 所用的BERT-VITS2版本缘故,项目暂时只支持中文
|
28 |
-
|
29 |
-
项目即将开源,测试完成后率先打包至autodl社区-Code with GPU
|
30 |
-
|
31 |
-
_我们诚挚地感谢您的支持与反馈。_
|
32 |
-
|
33 |
-
_feedback email:hhyxnh@gmail_
|
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 |
-
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
|
|
3 |
|
4 |
+
pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
|
5 |
|
6 |
+
def predict(input_img):
|
7 |
+
predictions = pipeline(input_img)
|
8 |
+
return input_img, {p["label"]: p["score"] for p in predictions}
|
9 |
|
10 |
+
gradio_app = gr.Interface(
|
11 |
+
predict,
|
12 |
+
inputs=gr.Image(label="Select hot dog candidate", sources=['upload', 'webcam'], type="pil"),
|
13 |
+
outputs=[gr.Image(label="Processed Image"), gr.Label(label="Result", num_top_classes=2)],
|
14 |
+
title="Hot Dog? Or Not?",
|
15 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
if __name__ == "__main__":
|
18 |
+
gradio_app.launch()
|