Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -278,13 +278,13 @@ def generate_response():
|
|
278 |
app.logger.info('Generator created')
|
279 |
|
280 |
|
281 |
-
response_tokens =
|
282 |
def generate_and_log_tokens(model, generator):
|
283 |
for token in generate_tokens(model, generator):
|
284 |
if token == b'': # or (max_new_tokens is not None and i >= max_new_tokens):
|
285 |
log(user_request, response_tokens.decode("utf-8", errors="ignore"))
|
286 |
break
|
287 |
-
response_tokens
|
288 |
yield token
|
289 |
|
290 |
# Use Response to stream tokens
|
|
|
278 |
app.logger.info('Generator created')
|
279 |
|
280 |
|
281 |
+
response_tokens = ''
|
282 |
def generate_and_log_tokens(model, generator):
|
283 |
for token in generate_tokens(model, generator):
|
284 |
if token == b'': # or (max_new_tokens is not None and i >= max_new_tokens):
|
285 |
log(user_request, response_tokens.decode("utf-8", errors="ignore"))
|
286 |
break
|
287 |
+
response_tokens += token
|
288 |
yield token
|
289 |
|
290 |
# Use Response to stream tokens
|