Spaces:
Runtime error
Runtime error
YanshekWoo
commited on
Commit
•
1a934e9
1
Parent(s):
e47f086
update generate parameters
Browse files
app.py
CHANGED
@@ -7,7 +7,6 @@ description = """
|
|
7 |
This is a seq2seq model fine-tuned on several Chinese dialogue datasets, from bart-large-chinese. \n
|
8 |
See some details of model card at https://huggingface.co/HIT-TMG/dialogue-bart-large-chinese . \n\n
|
9 |
Besides starting the conversation from scratch, you can also input the whole dialogue history utterance by utterance seperated by '[SEP]'. \n
|
10 |
-
(e.g. "可以认识一下吗[SEP]当然可以啦,你好。[SEP]嘿嘿你好,请问你最近在忙什么呢?[SEP]我最近养了一只狗狗,我在训练它呢。") \n
|
11 |
"""
|
12 |
|
13 |
|
@@ -17,6 +16,11 @@ model = BartForConditionalGeneration.from_pretrained("HIT-TMG/dialogue-bart-larg
|
|
17 |
tokenizer.truncation_side = 'left'
|
18 |
max_length = 512
|
19 |
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
def chat_func(input_utterance: str, history: Optional[List[str]] = None):
|
22 |
if history is not None:
|
@@ -53,6 +57,7 @@ demo = gr.Interface(fn=chat_func,
|
|
53 |
title=title,
|
54 |
description=description,
|
55 |
inputs=[gr.Textbox(lines=1, placeholder="Input current utterance"), "state"],
|
|
|
56 |
outputs=["chatbot", "state"])
|
57 |
|
58 |
|
|
|
7 |
This is a seq2seq model fine-tuned on several Chinese dialogue datasets, from bart-large-chinese. \n
|
8 |
See some details of model card at https://huggingface.co/HIT-TMG/dialogue-bart-large-chinese . \n\n
|
9 |
Besides starting the conversation from scratch, you can also input the whole dialogue history utterance by utterance seperated by '[SEP]'. \n
|
|
|
10 |
"""
|
11 |
|
12 |
|
|
|
16 |
tokenizer.truncation_side = 'left'
|
17 |
max_length = 512
|
18 |
|
19 |
+
examples = [
|
20 |
+
["你有什么爱好吗"],
|
21 |
+
["你好。[SEP]嘿嘿你好,请问你最近在忙什么呢?[SEP]我最近养了一只狗狗,我在训练它呢。"]
|
22 |
+
]
|
23 |
+
|
24 |
|
25 |
def chat_func(input_utterance: str, history: Optional[List[str]] = None):
|
26 |
if history is not None:
|
|
|
57 |
title=title,
|
58 |
description=description,
|
59 |
inputs=[gr.Textbox(lines=1, placeholder="Input current utterance"), "state"],
|
60 |
+
examples=examples,
|
61 |
outputs=["chatbot", "state"])
|
62 |
|
63 |
|