File size: 505 Bytes
336b276 03b8235 336b276 145701e 336b276 5656411 03b8235 141633b 5656411 336b276 5656411 145701e 5656411 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import gradio as gr
from transformers import pipeline
pipe = pipeline("text-generation", model="X-D-Lab/MindChat-Qwen2-0_5B")
def respond(message):
result = pipe(message, max_new_tokens=100)
return result[0]["generated_text"]
# 创建界面
gr.Interface(
fn=respond,
inputs="text",
outputs="text",
title="MindChat对话演示",
description="基于 X-D-Lab/MindChat-Qwen2-0_5B 构建的中文聊天机器人",
allow_flagging="never",
live=False
).launch(share=True) |