Warn: This repo isn't maintained anymore. Use Soulter/hugging-chat-api instead.
pip install hgchat
pip install --index-url https://codeberg.org/api/packages/Bavarder/pypi/simple/ hgchat
git clone https://codeberg.org/Bavarder/hgchat.git # or https://github.com/Bavarder/hgchat.git
cd hgchat
from hgchat import HGChat
hgchat = HGChat()
r = hgchat.ask(user_input)
for i in r:
char = i["token"]["text"]
if char == "</s>":
print("\n", end="")
else:
print(char, end="")
python chat.py