forked from acheong08/EdgeGPT
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrun.py
28 lines (23 loc) · 790 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import asyncio
import json
from src.EdgeGPT.EdgeGPT import Chatbot, ConversationStyle
async def async_main() -> None:
"""
Main function
"""
print("Initializing...")
print("Enter `alt+enter` or `escape+enter` to send a message")
# Read and parse cookies
cookies = json.loads(
open("C:\\Users\\Codete\\.config\\bing-cookies.json", encoding="utf-8").read()
)
bot = await Chatbot.create(cookies=cookies)
response = await bot.ask(
prompt="please describe the picture",
conversation_style=ConversationStyle.balanced,
simplify_response=False,
attachment="C:\\Users\\Codete\\OneDrive\\Pictures\\Ffrc-8-XoAcItDo.jpg",
)
await bot.close()
print(json.dumps(response, indent=2))
asyncio.run(async_main())