hzhwcmhf commited on
Commit
6ee15f3
1 Parent(s): 03c56f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +54 -54
app.py CHANGED
@@ -1,54 +1,54 @@
1
- from typing import List, Tuple, Union
2
- from web_ui import WebUI
3
- import math
4
- import os
5
-
6
- from qwen_agent.agents import Assistant
7
- from qwen_agent.gui.gradio import gr
8
-
9
- def app_gui():
10
- # Define the agent
11
- bot = Assistant(llm={
12
- 'model': os.environ.get("MODELNAME"),
13
- 'generate_cfg': {
14
- 'max_input_tokens': 32768,
15
- 'max_retries': 10,
16
- 'temperature': float(os.environ.get("T", 0.001)),
17
- 'repetition_penalty': float(os.environ.get("R", 1.0)),
18
- "top_k": int(os.environ.get("K", 20)),
19
- "top_p": float(os.environ.get("P", 0.8)),
20
- }},
21
- name='QwQ-32B-preview',
22
- description='QwQ-32B-Preview is an experimental research model developed by the Qwen Team, focused on advancing AI reasoning capabilities. As a preview release, it demonstrates promising analytical abilities while having several important limitations such as code switching and recursive reasoning loops. Only single-turn queries are supported in this demo.',
23
- system_message= 'You are a helpful and harmless assistant. You are Qwen developed by Alibaba. You should think step-by-step.',
24
- rag_cfg={'max_ref_token': 32768, 'rag_searchers': []},
25
- )
26
- chatbot_config = {
27
- 'input.placeholder': "Type \"/clear\" to clear the history",
28
- 'verbose': True,
29
- 'prompt.suggestions': [
30
- {
31
- 'text': 'How many r in strawberry'
32
- },
33
- {
34
- 'text': 'Find the least odd prime factor of $2019^8+1$.'
35
- },
36
- {
37
- 'text': '''S先生、P先生、Q先生他们知道桌子的抽屉里有16张扑克牌:红桃A、Q、4 黑桃J、8、4、2、7、3 草花K、Q、5、4、6 方块A、5。约翰教授从这16张牌中挑出一张牌来,并把这张牌的点数告诉 P先生,把这张牌的花色告诉Q先生。这时,约翰教授问P先生和Q 先生:你们能从已知的点数或花色中推知这张牌是什么牌吗?于是,S先生听到如下的对话:
38
-
39
- P先生:我不知道这张牌。
40
-
41
- Q先生:我知道你不知道这张牌。
42
-
43
- P先生:现在我知道这张牌了。
44
-
45
- Q先生:我也知道了。
46
-
47
- 请问:这张牌是什么牌?'''
48
- },
49
- ]
50
- }
51
- WebUI(bot, chatbot_config=chatbot_config).run()
52
-
53
- if __name__ == '__main__':
54
- app_gui()
 
1
+ from typing import List, Tuple, Union
2
+ from web_ui import WebUI
3
+ import math
4
+ import os
5
+
6
+ from qwen_agent.agents import Assistant
7
+ from qwen_agent.gui.gradio import gr
8
+
9
+ def app_gui():
10
+ # Define the agent
11
+ bot = Assistant(llm={
12
+ 'model': os.environ.get("MODELNAME"),
13
+ 'generate_cfg': {
14
+ 'max_input_tokens': 32768,
15
+ 'max_retries': 10,
16
+ 'temperature': float(os.environ.get("T", 0.001)),
17
+ 'repetition_penalty': float(os.environ.get("R", 1.0)),
18
+ "top_k": int(os.environ.get("K", 20)),
19
+ "top_p": float(os.environ.get("P", 0.8)),
20
+ }},
21
+ name='QwQ-32B-preview',
22
+ description='QwQ-32B-Preview is an experimental research model developed by the Qwen Team, focused on advancing AI reasoning capabilities. As a preview release, it demonstrates promising analytical abilities while having several important limitations such as code switching and recursive reasoning loops. Only single-turn queries are supported in this demo.',
23
+ system_message= 'You are a helpful and harmless assistant. You are Qwen developed by Alibaba. You should think step-by-step.',
24
+ rag_cfg={'max_ref_token': 32768, 'rag_searchers': []},
25
+ )
26
+ chatbot_config = {
27
+ 'input.placeholder': "Type \"/clear\" to clear the history",
28
+ 'verbose': True,
29
+ 'prompt.suggestions': [
30
+ {
31
+ 'text': 'How many r in strawberry'
32
+ },
33
+ {
34
+ 'text': 'Find the least odd prime factor of $2019^8+1$.'
35
+ },
36
+ {
37
+ 'text': '''S先生、P先生、Q先生他们知道桌子的抽屉里有16张扑克牌:红桃A、Q、4 黑桃J、8、4、2、7、3 草花K、Q、5、4、6 方块A、5。约翰教授从这16张牌中挑出一张牌来,并把这张牌的点数告诉 P先生,把这张牌的花色告诉Q先生。这时,约翰教授问P先生和Q 先生:你们能从已知的点数或花色中推知这张牌是什么牌吗?于是,S先生听到如下的对话:
38
+
39
+ P先生:我不知道这张牌。
40
+
41
+ Q先生:我知道你不知道这张牌。
42
+
43
+ P先生:现在我知道这张牌了。
44
+
45
+ Q先生:我也知道了。
46
+
47
+ 请问:这张牌是什么牌?'''
48
+ },
49
+ ]
50
+ }
51
+ WebUI(bot, chatbot_config=chatbot_config).run(concurrency_limit=80)
52
+
53
+ if __name__ == '__main__':
54
+ app_gui()