Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,18 +23,21 @@ client = InferenceClient(
|
|
| 23 |
def format_prompt(message, history):
|
| 24 |
prompt = "<s>"
|
| 25 |
|
| 26 |
-
#
|
| 27 |
-
|
| 28 |
-
|
| 29 |
# Iterates through every past user input and response to be added to the prompt
|
| 30 |
for user_prompt, bot_response in history:
|
| 31 |
-
|
| 32 |
-
|
|
|
|
| 33 |
prompt += f" {bot_response}</s> "
|
|
|
|
| 34 |
|
| 35 |
# Also prepend the prefix to the current message
|
| 36 |
corrected_message = grammar_correction_prefix + message
|
| 37 |
prompt += f"[INST] {corrected_message} [/INST]"
|
|
|
|
| 38 |
|
| 39 |
return prompt
|
| 40 |
|
|
|
|
| 23 |
def format_prompt(message, history):
|
| 24 |
prompt = "<s>"
|
| 25 |
|
| 26 |
+
# String to add before every prompt
|
| 27 |
+
prompt_prefix = "Please correct the grammar in the following sentence: "
|
| 28 |
+
|
| 29 |
# Iterates through every past user input and response to be added to the prompt
|
| 30 |
for user_prompt, bot_response in history:
|
| 31 |
+
corrected_prompt = prompt_prefix + user_prompt
|
| 32 |
+
|
| 33 |
+
prompt += f"[INST] {corrected_prompt} [/INST]"
|
| 34 |
prompt += f" {bot_response}</s> "
|
| 35 |
+
#print(f"HISTORIC PROMPT: \n\t[INST] {corrected_prompt} [/INST] {bot_response}</s> ")
|
| 36 |
|
| 37 |
# Also prepend the prefix to the current message
|
| 38 |
corrected_message = grammar_correction_prefix + message
|
| 39 |
prompt += f"[INST] {corrected_message} [/INST]"
|
| 40 |
+
print("\nPROMPT: \n\t" + prompt)
|
| 41 |
|
| 42 |
return prompt
|
| 43 |
|