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()