Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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"
|
| 22 |
else:
|
| 23 |
input_text_with_history = f"{history[-1][1]}"+ "\n"
|
| 24 |
-
input_text_with_history += f"
|
| 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"])
|