Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -10,6 +10,13 @@ def predict(input, history=[]):
|
|
10 |
bot_input_ids = torch.cat([torch.LongTensor(history), new_user_input_ids], dim=-1)
|
11 |
history = model.generate(bot_input_ids, max_length=500, pad_token_id=tokenizer.eos_token_id).tolist()
|
12 |
response = tokenizer.decode(history[0]).replace("<|endoftext|>", "\n")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
return response, history
|
14 |
|
15 |
css = """
|
|
|
10 |
bot_input_ids = torch.cat([torch.LongTensor(history), new_user_input_ids], dim=-1)
|
11 |
history = model.generate(bot_input_ids, max_length=500, pad_token_id=tokenizer.eos_token_id).tolist()
|
12 |
response = tokenizer.decode(history[0]).replace("<|endoftext|>", "\n")
|
13 |
+
|
14 |
+
html = "<div class='chatbot'>"
|
15 |
+
for m, msg in enumerate(response):
|
16 |
+
cls = "user" if m%2 == 0 else "bot"
|
17 |
+
html += "<div class='msg {}'> {}</div>".format(cls, msg)
|
18 |
+
html += "</div>"
|
19 |
+
|
20 |
return response, history
|
21 |
|
22 |
css = """
|