Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,27 +6,6 @@ client = InferenceClient(
|
|
| 6 |
)
|
| 7 |
|
| 8 |
# Formats the prompt to hold all of the past messages
|
| 9 |
-
def format_prompt1(message, history):
|
| 10 |
-
prompt = "<s>"
|
| 11 |
-
|
| 12 |
-
# String to add before every prompt
|
| 13 |
-
prompt_prefix = "Please correct the grammar in the following sentence:"
|
| 14 |
-
prompt_template = "[INST] " + prompt_prefix + " {} [/INST]"
|
| 15 |
-
|
| 16 |
-
#history.append("It is my friends house in England.", "It is my friend's house in England.")
|
| 17 |
-
#history.append("Every girl must bring their books to school.", "Every girl must bring her books to school.")
|
| 18 |
-
|
| 19 |
-
# Iterates through every past user input and response to be added to the prompt
|
| 20 |
-
for user_prompt, bot_response in history:
|
| 21 |
-
prompt += prompt_template.format(user_prompt)
|
| 22 |
-
prompt += f" {bot_response}</s> "
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
prompt += prompt_template.format(message)
|
| 26 |
-
print("\nPROMPT: \n\t" + prompt)
|
| 27 |
-
|
| 28 |
-
return prompt
|
| 29 |
-
|
| 30 |
def format_prompt(message, history):
|
| 31 |
prompt = "<s>"
|
| 32 |
|
|
|
|
| 6 |
)
|
| 7 |
|
| 8 |
# Formats the prompt to hold all of the past messages
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
def format_prompt(message, history):
|
| 10 |
prompt = "<s>"
|
| 11 |
|