Closed MasterZitron closed 5 years ago
Hi @MasterZitron, in what way do you want to use chat.py from another python program? chat.py is a stand-alone script and therefore is not set up as a class or function that you can call from other code. It would be pretty straightforward to adapt the script for use within other programs but I would need more context.
Like a discord/twitter bot, whenever it's mentioned, it replies. (discord is what I'm really looking into.)
You have two options.
1) You can use chat_web.py to start a flask server and then issue an http request from your discord bot to get the response. See chat_ui.html for an example in JavaScript.
2) You can do what chat.py does, but in your own program. This means creating an instance of ChatbotModel and then calling the model.load and model.chat methods. You will need to keep the model instance around as long as the discord bot is online to avoid reloading the checkpoint on every dialog turn.
Thanks! I'll try to get this working.
I don't have much experience with Python, but I'm pretty sure this can happen, I just don't know how.
As the title says, I want another python program use chat.py (I got it to work on the cmd and its perfect, just wish I could add more data to it).
It's probably very simple and I'm just dumb, but please help me.