Spaces:
Running
Running
from typing import List, Tuple, Union | |
from web_ui import WebUI | |
import math | |
import os | |
from qwen_agent.agents import Assistant | |
from qwen_agent.gui.gradio import gr | |
def app_gui(): | |
# Define the agent | |
bot = Assistant(llm={ | |
'model': os.environ.get("MODELNAME"), | |
'model_type': 'qwen_dashscope', | |
'generate_cfg': { | |
'max_input_tokens': 32768, | |
'max_retries': 10, | |
'temperature': float(os.environ.get("T", 0.001)), | |
'repetition_penalty': float(os.environ.get("R", 1.0)), | |
"top_k": int(os.environ.get("K", 20)), | |
"top_p": float(os.environ.get("P", 0.8)), | |
}}, | |
name='QwQ-32B-preview', | |
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.', | |
system_message= 'You are a helpful and harmless assistant. You are Qwen developed by Alibaba. You should think step-by-step.', | |
rag_cfg={'max_ref_token': 32768, 'rag_searchers': []}, | |
) | |
chatbot_config = { | |
'input.placeholder': "Type \"/clear\" to clear the history", | |
'verbose': True, | |
'prompt.suggestions': [ | |
{ | |
'text': 'How many r in strawberry' | |
}, | |
{ | |
'text': 'Find the least odd prime factor of $2019^8+1$.' | |
}, | |
{ | |
'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ๅ ็ๅฌๅฐๅฆไธ็ๅฏน่ฏ๏ผ | |
Pๅ ็๏ผๆไธ็ฅ้่ฟๅผ ็ใ | |
Qๅ ็๏ผๆ็ฅ้ไฝ ไธ็ฅ้่ฟๅผ ็ใ | |
Pๅ ็๏ผ็ฐๅจๆ็ฅ้่ฟๅผ ็ไบใ | |
Qๅ ็๏ผๆไน็ฅ้ไบใ | |
่ฏท้ฎ๏ผ่ฟๅผ ็ๆฏไปไน็๏ผ''' | |
}, | |
] | |
} | |
WebUI(bot, chatbot_config=chatbot_config).run(concurrency_limit=80) | |
if __name__ == '__main__': | |
app_gui() | |