Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -5,13 +5,32 @@ client = InferenceClient(
|
|
5 |
"mistralai/Mixtral-8x7B-Instruct-v0.1"
|
6 |
)
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
# Formats the prompt to hold all of the past messages
|
9 |
def format_prompt(message, history):
|
10 |
prompt = "<s>"
|
11 |
|
12 |
# String to add before every prompt
|
13 |
prompt_prefix = "Correct any grammatical errors in the following sentence and provide the corrected version:\n\nSentence: "
|
14 |
-
prompt_template = "[INST] " + prompt_prefix + '
|
15 |
|
16 |
|
17 |
myList = [["It is my friends house in England.", "It is my friend's house in England."], ["Every girl must bring their books to school.", "Every girl must bring her books to school."]]
|
|
|
5 |
"mistralai/Mixtral-8x7B-Instruct-v0.1"
|
6 |
)
|
7 |
|
8 |
+
# Formats the prompt to hold all of the past messages
|
9 |
+
def format_prompt_basic(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 |
+
|
17 |
+
# Iterates through every past user input and response to be added to the prompt
|
18 |
+
for user_prompt, bot_response in history:
|
19 |
+
prompt += prompt_template.format(user_prompt)
|
20 |
+
prompt += f" {bot_response}</s> "
|
21 |
+
|
22 |
+
prompt += prompt_template.format(message)
|
23 |
+
print("\nPROMPT: \n\t" + prompt)
|
24 |
+
|
25 |
+
return prompt
|
26 |
+
|
27 |
# Formats the prompt to hold all of the past messages
|
28 |
def format_prompt(message, history):
|
29 |
prompt = "<s>"
|
30 |
|
31 |
# String to add before every prompt
|
32 |
prompt_prefix = "Correct any grammatical errors in the following sentence and provide the corrected version:\n\nSentence: "
|
33 |
+
prompt_template = "[INST] " + prompt_prefix + ' {} [/INST]'
|
34 |
|
35 |
|
36 |
myList = [["It is my friends house in England.", "It is my friend's house in England."], ["Every girl must bring their books to school.", "Every girl must bring her books to school."]]
|