Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ def preprocess(text):
|
|
22 |
def postprocess(text):
|
23 |
return text.replace("\\n", "\n").replace("\\t", "\t")
|
24 |
|
25 |
-
def answer(text, sample=True, top_p=
|
26 |
'''sample:是否抽样。生成任务,可以设置为True;
|
27 |
top_p:0-1之间,生成的内容越多样
|
28 |
max_new_tokens=512 lost...'''
|
@@ -41,13 +41,9 @@ def command_result(text):
|
|
41 |
output = answer(text)
|
42 |
return output
|
43 |
|
44 |
-
iface = gr.Interface(fn=command_result, inputs="text", outputs="text", title="中文聊天机器人Demo")
|
45 |
-
iface.launch()
|
46 |
-
|
47 |
-
|
48 |
|
49 |
input_component = gr.Textbox(label = "输入你要对话的文本", value = "你好!")
|
50 |
output_component = gr.Textbox(label = "机器人回复")
|
51 |
examples = [["你好!"], ["请自我介绍一下!"]]
|
52 |
description = "这是一个使用ClueAI/ChatYuan-large-v1构建的中文文本对话聊天机器人"
|
53 |
-
gr.Interface(command_result, inputs = input_component, outputs=output_component, examples=examples, title = "👨🏻🎤
|
|
|
22 |
def postprocess(text):
|
23 |
return text.replace("\\n", "\n").replace("\\t", "\t")
|
24 |
|
25 |
+
def answer(text, sample=True, top_p=1, temperature=0.7):
|
26 |
'''sample:是否抽样。生成任务,可以设置为True;
|
27 |
top_p:0-1之间,生成的内容越多样
|
28 |
max_new_tokens=512 lost...'''
|
|
|
41 |
output = answer(text)
|
42 |
return output
|
43 |
|
|
|
|
|
|
|
|
|
44 |
|
45 |
input_component = gr.Textbox(label = "输入你要对话的文本", value = "你好!")
|
46 |
output_component = gr.Textbox(label = "机器人回复")
|
47 |
examples = [["你好!"], ["请自我介绍一下!"]]
|
48 |
description = "这是一个使用ClueAI/ChatYuan-large-v1构建的中文文本对话聊天机器人"
|
49 |
+
gr.Interface(command_result, inputs = input_component, outputs=output_component, examples=examples, title = "👨🏻🎤 中文对话聊天机器人 👨🏻🎤", description=description).launch()
|