Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ Propose auto-completion to the text. You have several roles:
|
|
22 |
|
23 |
Don't suggest anything if there are no good suggestions.
|
24 |
Make sure the suggestions are valid completions of the text! Suggest only up to 5 words ahead. The scheme of your answer should be "answer1;answer2;answer3" (return between 0 to 4 answers).
|
25 |
-
Answers should be only the completions themselves.
|
26 |
Examples:
|
27 |
(1)
|
28 |
User: "Help me write a sentiment analysis pipeline"
|
@@ -30,12 +30,11 @@ Assistant: "using huggingface;using NLTK;using python"
|
|
30 |
|
31 |
(2)
|
32 |
User: "My name is"
|
33 |
-
Assistant: "" (nothing much to contribute at this point. return nothing)
|
34 |
|
35 |
(3)
|
36 |
User: "Help me find a present for my"
|
37 |
Assistant: "girlfriend;mother;father;friend"
|
38 |
-
|
39 |
'''
|
40 |
|
41 |
# '''
|
@@ -97,6 +96,7 @@ def generate(text, past_key_values):
|
|
97 |
cur_generate_kwargs.update({'past_key_values': past_key_values})
|
98 |
|
99 |
response = pipe(messages, **cur_generate_kwargs)[0]['generated_text']
|
|
|
100 |
return response[-1]['content']
|
101 |
|
102 |
|
|
|
22 |
|
23 |
Don't suggest anything if there are no good suggestions.
|
24 |
Make sure the suggestions are valid completions of the text! Suggest only up to 5 words ahead. The scheme of your answer should be "answer1;answer2;answer3" (return between 0 to 4 answers).
|
25 |
+
Answers should be only the completions themselves. If you have nothing as a completion, return "<NOTHING>".
|
26 |
Examples:
|
27 |
(1)
|
28 |
User: "Help me write a sentiment analysis pipeline"
|
|
|
30 |
|
31 |
(2)
|
32 |
User: "My name is"
|
33 |
+
Assistant: "<NOTHING>" (nothing much to contribute at this point. return nothing)
|
34 |
|
35 |
(3)
|
36 |
User: "Help me find a present for my"
|
37 |
Assistant: "girlfriend;mother;father;friend"
|
|
|
38 |
'''
|
39 |
|
40 |
# '''
|
|
|
96 |
cur_generate_kwargs.update({'past_key_values': past_key_values})
|
97 |
|
98 |
response = pipe(messages, **cur_generate_kwargs)[0]['generated_text']
|
99 |
+
print(response)
|
100 |
return response[-1]['content']
|
101 |
|
102 |
|