Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -56,6 +56,10 @@ def respond(
|
|
56 |
|
57 |
|
58 |
for event in completion:
|
|
|
|
|
|
|
|
|
59 |
if hasattr(event.choices[0].delta, 'reasoning_content') and event.choices[0].delta.reasoning_content:
|
60 |
if is_reasoning_start:
|
61 |
response += '> **Start thinking**\n\n'
|
@@ -75,44 +79,41 @@ def respond(
|
|
75 |
example_prompts = [
|
76 |
[
|
77 |
"Write a short papragraph where the 1st letter of each sentence spells out the word 'CODE'. The message should appear natural and not obviously hide this pattern.",
|
78 |
-
"
|
79 |
-
|
80 |
-
0.8,
|
81 |
0.85
|
82 |
],
|
83 |
[
|
84 |
"Compose an engaging travel blog post about a recent trip to Hawaii, highlighting cultural experiences and must-see attractions.",
|
85 |
-
"
|
86 |
-
|
87 |
0.3,
|
88 |
0.9
|
89 |
],
|
90 |
[
|
91 |
"Why has online learning been able to spread rapidly in recent years?",
|
92 |
-
"
|
93 |
-
|
94 |
0.1,
|
95 |
0.95
|
96 |
],
|
97 |
[
|
98 |
"How many 'e' in Deeplearning?",
|
99 |
-
"
|
100 |
-
|
101 |
1.2,
|
102 |
0.75
|
103 |
],
|
104 |
[
|
105 |
"Write a 3-line poem",
|
106 |
-
"
|
107 |
-
|
108 |
0.6,
|
109 |
0.88
|
110 |
]
|
111 |
]
|
112 |
-
|
113 |
-
["你好,能推荐一部电影吗?", "你是一个电影推荐助手", 512, 0.7, 0.95],
|
114 |
-
["解释量子力学", "你是一个物理教授", 1024, 0.5, 0.9]
|
115 |
-
]
|
116 |
latex_delimiters = [
|
117 |
{"left": "$$", "right": "$$", "display": True},
|
118 |
{"left": "\\[", "right": "\\]", "display": True},{"left": "$", "right": "$", "display": False},
|
@@ -125,9 +126,9 @@ chatbot = gr.Chatbot(latex_delimiters=latex_delimiters, scale=9)
|
|
125 |
|
126 |
demo = gr.ChatInterface(respond,
|
127 |
title="Hunyuan-T1",
|
|
|
128 |
chatbot=chatbot,
|
129 |
-
description="当前体验demo为非联网Hunyuan-T1 最新推理模型,完整版联网/非联网能力即将在元宝上线,敬请期待!</br>The current demo is the latest reasoning model of Hunyuan-T1. The full version with browsing will be launched on Tencent Yuanbao soon. Stay tuned."
|
130 |
-
|
131 |
)
|
132 |
|
133 |
if __name__ == "__main__":
|
|
|
56 |
|
57 |
|
58 |
for event in completion:
|
59 |
+
if message == "深圳哪里好玩?":
|
60 |
+
print(111111)
|
61 |
+
print(event.choices[0].delta.reasoning_content)
|
62 |
+
print(event.choices[0].delta.content)
|
63 |
if hasattr(event.choices[0].delta, 'reasoning_content') and event.choices[0].delta.reasoning_content:
|
64 |
if is_reasoning_start:
|
65 |
response += '> **Start thinking**\n\n'
|
|
|
79 |
example_prompts = [
|
80 |
[
|
81 |
"Write a short papragraph where the 1st letter of each sentence spells out the word 'CODE'. The message should appear natural and not obviously hide this pattern.",
|
82 |
+
"你是一个电影推荐助手",
|
83 |
+
256,
|
84 |
+
0.8,
|
85 |
0.85
|
86 |
],
|
87 |
[
|
88 |
"Compose an engaging travel blog post about a recent trip to Hawaii, highlighting cultural experiences and must-see attractions.",
|
89 |
+
"你是一个AI教授",
|
90 |
+
128,
|
91 |
0.3,
|
92 |
0.9
|
93 |
],
|
94 |
[
|
95 |
"Why has online learning been able to spread rapidly in recent years?",
|
96 |
+
"你是一个数学老师",
|
97 |
+
64,
|
98 |
0.1,
|
99 |
0.95
|
100 |
],
|
101 |
[
|
102 |
"How many 'e' in Deeplearning?",
|
103 |
+
"你是一个科幻作家",
|
104 |
+
512,
|
105 |
1.2,
|
106 |
0.75
|
107 |
],
|
108 |
[
|
109 |
"Write a 3-line poem",
|
110 |
+
"你是一个历史学者",
|
111 |
+
384,
|
112 |
0.6,
|
113 |
0.88
|
114 |
]
|
115 |
]
|
116 |
+
|
|
|
|
|
|
|
117 |
latex_delimiters = [
|
118 |
{"left": "$$", "right": "$$", "display": True},
|
119 |
{"left": "\\[", "right": "\\]", "display": True},{"left": "$", "right": "$", "display": False},
|
|
|
126 |
|
127 |
demo = gr.ChatInterface(respond,
|
128 |
title="Hunyuan-T1",
|
129 |
+
examples=example_prompts,
|
130 |
chatbot=chatbot,
|
131 |
+
description="当前体验demo为非联网Hunyuan-T1 最新推理模型,完整版联网/非联网能力即将在元宝上线,敬请期待!</br>The current demo is the latest reasoning model of Hunyuan-T1. The full version with browsing will be launched on Tencent Yuanbao soon. Stay tuned."
|
|
|
132 |
)
|
133 |
|
134 |
if __name__ == "__main__":
|