Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -14,9 +14,9 @@ def predict(input, history=[]):
|
|
14 |
# generate a response
|
15 |
history = model.generate(bot_input_ids, max_length=1000, pad_token_id=tokenizer.eos_token_id).tolist()
|
16 |
|
17 |
-
# convert the tokens to text, and then split the responses into
|
18 |
-
response = tokenizer.decode(history[0]).
|
19 |
-
|
20 |
return response, history
|
21 |
|
22 |
import gradio as gr
|
|
|
14 |
# generate a response
|
15 |
history = model.generate(bot_input_ids, max_length=1000, pad_token_id=tokenizer.eos_token_id).tolist()
|
16 |
|
17 |
+
# convert the tokens to text, and then split the responses into the right format
|
18 |
+
response = tokenizer.decode(history[0]).split("<|endoftext|>")
|
19 |
+
response = [(response[i], response[i+1]) for i in range(0, len(response)-1, 2)] # convert to tuples of list
|
20 |
return response, history
|
21 |
|
22 |
import gradio as gr
|