zac commited on
Commit
d264f30
1 Parent(s): b139f7c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -18,12 +18,12 @@ def generate_text(input_text, history):
18
  print("input ", input_text)
19
  temp =""
20
  if history == []:
21
- input_text_with_history = f"{pre_prompt}"+ "\n" + f"<|prompter|> {input_text} " + "\n" +" <|assistant|>"
22
  else:
23
  input_text_with_history = f"{history[-1][1]}"+ "\n"
24
- input_text_with_history += f"<|prompter|> {input_text}" + "\n" +" <|assistant|>"
25
  print("new input", input_text_with_history)
26
- output = llm(input_text_with_history, max_tokens=1024, stop=["<|prompter|>", "<|endoftext|>", "<|endoftext|> \n"], stream=True)
27
  for out in output:
28
  stream = copy.deepcopy(out)
29
  print(stream["choices"][0]["text"])
 
18
  print("input ", input_text)
19
  temp =""
20
  if history == []:
21
+ input_text_with_history = f"SYSTEM:{pre_prompt}"+ "\n" + f"USER: {input_text} " + "\n" +" ASSISTANT:"
22
  else:
23
  input_text_with_history = f"{history[-1][1]}"+ "\n"
24
+ input_text_with_history += f"USER: {input_text}" + "\n" +" ASSISTANT:"
25
  print("new input", input_text_with_history)
26
+ output = llm(input_text_with_history, max_tokens=1024, stop=["<|prompter|>", "<|endoftext|>", "<|endoftext|> \n","ASSISTANT:","USER:","SYSTEM:"], stream=True)
27
  for out in output:
28
  stream = copy.deepcopy(out)
29
  print(stream["choices"][0]["text"])