I made a chatbot web app that uses Gradio Blocks for the interface and makes API calls to ChatGPT to generate responses, similar to this: gradio-chatgpt-app/mywebgpt.py at main · aimerou/gradio-chatgpt-app · GitHub.
I want the model to start fresh and clear all the message history every time I re-load the browser where my app is hosted. But, the only time that happens now is when I re-run my code entirely and run demo.launch() again.
How do I launch my demo each time the browser is opened and close the demo when the browser is closed?