Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
danielgross
GitHub Repository: danielgross/whatsapp-gpt
Path: blob/main/multichat.py
122 views
1
"""Get ChatGPT to talk to itself."""
2
3
import requests
4
5
# Launch two instances of server.py
6
# python3 server.py --port 5001 --profile /tmp/chat1
7
# python3 server.py --port 5002 --profile /tmp/chat2
8
9
metaprompt = "Now make that funnier."
10
chat1 = requests.get("http://localhost:5001/chat?q=%s" % "Teach me about quantum mechanics in a 140 characters or less.")
11
while True:
12
chat2 = requests.get("http://localhost:5002/chat?q=%s" % (chat1.text.replace(metaprompt, "") + " " + metaprompt))
13
chat1 = requests.get("http://localhost:5001/chat?q=%s" % (chat2.text.replace(metaprompt, "") + " " + metaprompt))
14
15
16