(_query, _chatbot, _task_history)
| 117 | def _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: |
no test coverage detected