Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -52,10 +52,11 @@ def format_prompt_grammar(message):
|
|
52 |
prompt = "<s>"
|
53 |
|
54 |
# String to add before every prompt
|
55 |
-
prompt_prefix = "Correct any grammatical errors in the following sentence and provide the corrected version:\nSentence:"
|
56 |
prompt_template = "[INST] " + prompt_prefix + ' {} [/INST]'
|
57 |
|
58 |
-
history = [["It is my friends house in England.", "It is my friend's house in England."],
|
|
|
59 |
|
60 |
# Iterates through every past user input and response to be added to the prompt
|
61 |
for user_prompt, bot_response in history:
|
@@ -79,7 +80,8 @@ def generate(prompt, history, system_prompt, temperature=0.9, max_new_tokens=256
|
|
79 |
|
80 |
#formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
|
81 |
#formatted_prompt = format_prompt_grammar(f"{system_prompt} {prompt}", history)
|
82 |
-
formatted_prompt = format_prompt_grammar(prompt)
|
|
|
83 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
84 |
output = ""
|
85 |
|
|
|
52 |
prompt = "<s>"
|
53 |
|
54 |
# String to add before every prompt
|
55 |
+
prompt_prefix = "Correct any grammatical errors in the following sentence and provide the corrected version:\n\nSentence:"
|
56 |
prompt_template = "[INST] " + prompt_prefix + ' {} [/INST]'
|
57 |
|
58 |
+
history = [["It is my friends house in England.", "It is my friend's house in England."],
|
59 |
+
["Every girl must bring their books to school.", "Every girl must bring her books to school."]]# ["I have been to New York last summer.", "I went to New York last summer."]]
|
60 |
|
61 |
# Iterates through every past user input and response to be added to the prompt
|
62 |
for user_prompt, bot_response in history:
|
|
|
80 |
|
81 |
#formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)
|
82 |
#formatted_prompt = format_prompt_grammar(f"{system_prompt} {prompt}", history)
|
83 |
+
#formatted_prompt = format_prompt_grammar(prompt)
|
84 |
+
formatted_prompt = format_prompt_grammar(f"{system_prompt} {prompt}")
|
85 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
86 |
output = ""
|
87 |
|