MCPcopy
hub / github.com/QwenLM/Qwen / predict

Function predict

web_demo.py:119–132  ·  view source on GitHub ↗
(_query, _chatbot, _task_history)

Source from the content-addressed store, hash-verified

117def _launch_demo(args, model, tokenizer, config):
118
119 def predict(_query, _chatbot, _task_history):
120 print(f"User: {_parse_text(_query)}")
121 _chatbot.append((_parse_text(_query), ""))
122 full_response = ""
123
124 for response in model.chat_stream(tokenizer, _query, history=_task_history, generation_config=config):
125 _chatbot[-1] = (_parse_text(_query), _parse_text(response))
126
127 yield _chatbot
128 full_response = _parse_text(response)
129
130 print(f"History: {_task_history}")
131 _task_history.append((_query, full_response))
132 print(f"Qwen-Chat: {_parse_text(full_response)}")
133
134 def regenerate(_chatbot, _task_history):
135 if not _task_history:

Callers 1

regenerateFunction · 0.70

Calls 1

_parse_textFunction · 0.85

Tested by

no test coverage detected