Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,7 +13,10 @@ history = []
|
|
| 13 |
def generate_text(input_text, history):
|
| 14 |
print("history ",history)
|
| 15 |
print("input ", input_text)
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
| 17 |
print("new input", input_text_with_history)
|
| 18 |
output = llm(f"Q: {input_text_with_history} \n A:", max_tokens=1024, stop=["Q:", "\n"], echo=True)
|
| 19 |
response = output['choices'][0]['text']
|
|
@@ -26,4 +29,3 @@ demo.launch()
|
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
-
|
|
|
|
| 13 |
def generate_text(input_text, history):
|
| 14 |
print("history ",history)
|
| 15 |
print("input ", input_text)
|
| 16 |
+
if history == []:
|
| 17 |
+
input_text_with_history = input_text
|
| 18 |
+
else:
|
| 19 |
+
input_text_with_history = "".join(i[0] + " \n"+i[1] for i in history)
|
| 20 |
print("new input", input_text_with_history)
|
| 21 |
output = llm(f"Q: {input_text_with_history} \n A:", max_tokens=1024, stop=["Q:", "\n"], echo=True)
|
| 22 |
response = output['choices'][0]['text']
|
|
|
|
| 29 |
|
| 30 |
|
| 31 |
|
|
|