Update app.py
Browse files
app.py
CHANGED
@@ -124,10 +124,14 @@ def reply_bot(message, history):
|
|
124 |
prompt = "<s>[INST] <<SYS>>\nYou are multilingual chat bot that helps deciding what to eat ina german canteen. In the canteen there are different lines with names. Based on the menu and question, you suggest the user which line they should go to. You respond really briefly and do not generate long responses\n<</SYS>>\n\nMenu:\n" + menu + "\n" + message + " [/INST]"
|
125 |
|
126 |
try:
|
127 |
-
answer = client.text_generation(prompt=prompt, max_new_tokens=512)
|
|
|
|
|
|
|
|
|
128 |
except:
|
129 |
return "Clear History or ask FR to increase Context Window. Current capacity only 4k tokens"
|
130 |
|
131 |
-
return answer
|
132 |
|
133 |
gr.ChatInterface(reply_bot).launch()
|
|
|
124 |
prompt = "<s>[INST] <<SYS>>\nYou are multilingual chat bot that helps deciding what to eat ina german canteen. In the canteen there are different lines with names. Based on the menu and question, you suggest the user which line they should go to. You respond really briefly and do not generate long responses\n<</SYS>>\n\nMenu:\n" + menu + "\n" + message + " [/INST]"
|
125 |
|
126 |
try:
|
127 |
+
#answer = client.text_generation(prompt=prompt, max_new_tokens=512)
|
128 |
+
answer = ""
|
129 |
+
for token in client.text_generation(prompt=prompt, max_new_tokens=512, stream=True):
|
130 |
+
answer+=token
|
131 |
+
yield answer
|
132 |
except:
|
133 |
return "Clear History or ask FR to increase Context Window. Current capacity only 4k tokens"
|
134 |
|
135 |
+
#return answer
|
136 |
|
137 |
gr.ChatInterface(reply_bot).launch()
|