docker_test4 / main.py
Yusin's picture
Update main.py
40f80fd
raw
history blame
716 Bytes
#import requests
import os
import asyncio
from pygpt import PyGPT
session_token = os.environ.get('SessionToken')
conversation_id = os.environ.get('conversation_id')
async def main():
chat_gpt = PyGPT(session_token)
await chat_gpt.connect()
await chat_gpt.wait_for_ready()
answer = await chat_gpt.ask('What is the capital of France?')
print(answer)
await chat_gpt.disconnect()
if __name__ == '__main__':
asyncio.run(main())
'''
if __name__ == "__main__":
headers = {'Authorization': 'yusin'}
data = {"content": 'am I stupid'}
response = requests.post('http://93.56.204.222:7788/api/ask', headers=headers, json=data)
print('this is my answear', response.text)
'''