ColeGuion commited on
Commit
b2631fe
·
verified ·
1 Parent(s): 3a3ea8c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -23,18 +23,21 @@ client = InferenceClient(
23
  def format_prompt(message, history):
24
  prompt = "<s>"
25
 
26
- # Prepend "Please correct the grammar in the following sentence: " to each user input
27
- grammar_correction_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_user_prompt = grammar_correction_prefix + user_prompt
32
- prompt += f"[INST] {corrected_user_prompt} [/INST]"
 
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