Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,7 +13,6 @@ history = []
|
|
| 13 |
def generate_text(input_text, history):
|
| 14 |
print("history ",history)
|
| 15 |
print("input ", input_text)
|
| 16 |
-
print("response", response)
|
| 17 |
if history == []:
|
| 18 |
input_text_with_history = f"Q: {input_text} \n A:"
|
| 19 |
else:
|
|
@@ -22,8 +21,9 @@ def generate_text(input_text, history):
|
|
| 22 |
print("new input", input_text_with_history)
|
| 23 |
output = llm(input_text_with_history, max_tokens=1024, stop=["Q:", "\n"], echo=True)
|
| 24 |
response = output['choices'][0]['text'] + "\n"
|
|
|
|
| 25 |
history =["init",input_text_with_history]
|
| 26 |
-
|
| 27 |
|
| 28 |
|
| 29 |
demo = gr.ChatInterface(generate_text)
|
|
|
|
| 13 |
def generate_text(input_text, history):
|
| 14 |
print("history ",history)
|
| 15 |
print("input ", input_text)
|
|
|
|
| 16 |
if history == []:
|
| 17 |
input_text_with_history = f"Q: {input_text} \n A:"
|
| 18 |
else:
|
|
|
|
| 21 |
print("new input", input_text_with_history)
|
| 22 |
output = llm(input_text_with_history, max_tokens=1024, stop=["Q:", "\n"], echo=True)
|
| 23 |
response = output['choices'][0]['text'] + "\n"
|
| 24 |
+
print("response", response)
|
| 25 |
history =["init",input_text_with_history]
|
| 26 |
+
yield response
|
| 27 |
|
| 28 |
|
| 29 |
demo = gr.ChatInterface(generate_text)
|