-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
29 lines (22 loc) · 761 Bytes
/
main.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
29
import os
from dotenv import load_dotenv, find_dotenv
from src.utils import read_json
from src.visiongpt import VisionGPT
from src.models import OpenAIModel
load_dotenv(find_dotenv())
model = OpenAIModel(
api_key=os.getenv("OPENAI_KEY"),
temperature=int(os.getenv("OPENAI_TEMPERATURE")),
max_tokens=int(os.getenv("OPENAI_TOKENS")),
)
system_message = read_json("system.json")
visiongpt = VisionGPT(model, system_message)
def run():
print(str(visiongpt))
print(str(model))
print("")
image_url = "https://ams3.digitaloceanspaces.com/graffica/2022/12/Adidas-Logo-1971-1024x576.jpeg"
role, response = visiongpt.recognition_image(image_url)
print(f"Role: {role}, Response: {response}")
if __name__ == "__main__":
run()