Spaces:
Build error
Build error
clean up
Browse files
app.py
CHANGED
|
@@ -40,18 +40,3 @@ iface = gr.Interface(
|
|
| 40 |
allow_flagging="never",
|
| 41 |
)
|
| 42 |
iface.launch()
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
new_user_input_ids = tokenizer.encode(text+tokenizer.eos_token, return_tensors='pt')
|
| 47 |
-
# append the new user input tokens to the chat history
|
| 48 |
-
bot_input_ids = torch.cat([chat_history_ids, new_user_input_ids], dim=-1) if chat_history_ids is not None else new_user_input_ids
|
| 49 |
-
|
| 50 |
-
# generated a response while limiting the total chat history to 1000 tokens,
|
| 51 |
-
chat_history_ids = model.generate(bot_input_ids, max_length=5000, pad_token_id=tokenizer.eos_token_id)
|
| 52 |
-
print("The text is ", [text])
|
| 53 |
-
|
| 54 |
-
# pretty print last ouput tokens from bot
|
| 55 |
-
output = tokenizer.decode(chat_history_ids[:, bot_input_ids.shape[-1]:][0], skip_special_tokens=True)
|
| 56 |
-
print("The outout is :", output)
|
| 57 |
-
text_session.append(output)
|
|
|
|
| 40 |
allow_flagging="never",
|
| 41 |
)
|
| 42 |
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|