KGSAGAR commited on
Commit
25c54aa
·
verified ·
1 Parent(s): 14e4a65

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -30,10 +30,10 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
30
  prompt = system_message
31
  for user_msg, assistant_msg in history:
32
  if user_msg:
33
- prompt += f"\nUser: {user_msg}"
34
  if assistant_msg:
35
  prompt += f"\nAssistant: {assistant_msg}"
36
- prompt += f"\nUser: {message}"
37
 
38
  # Tokenize the input prompt
39
  inputs = tokenizer(prompt, return_tensors="pt", truncation=True)
@@ -58,7 +58,7 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
58
  If 'output' is not found, returns an empty string.
59
  """
60
  # Define the regular expression pattern to match 'output' and capture everything after it
61
- pattern = re.compile(r'user:\s*:\s*(.*)', re.IGNORECASE | re.DOTALL)
62
  match = pattern.search(text)
63
  if match:
64
  # Return the captured group, which is the content after 'output'
 
30
  prompt = system_message
31
  for user_msg, assistant_msg in history:
32
  if user_msg:
33
+ prompt += f"\nUser: {user_msg} output: "
34
  if assistant_msg:
35
  prompt += f"\nAssistant: {assistant_msg}"
36
+ prompt += f"\nUser: {message} output:"
37
 
38
  # Tokenize the input prompt
39
  inputs = tokenizer(prompt, return_tensors="pt", truncation=True)
 
58
  If 'output' is not found, returns an empty string.
59
  """
60
  # Define the regular expression pattern to match 'output' and capture everything after it
61
+ pattern = re.compile(r'output:\s*:\s*(.*)', re.IGNORECASE | re.DOTALL)
62
  match = pattern.search(text)
63
  if match:
64
  # Return the captured group, which is the content after 'output'