Open WilliamHaiweiGu opened 3 months ago
@WilliamHaiweiGu
Hello,
I have modified the utils/gpt4_query.py
file (lines 68-73). Please re-test the code.
The returned value response
from GPT-4 is of type 'ChatCompletion'. We use json.loads(response.json())
to convert it into a dict
format, as shown in the figure. Please verify the response type to ensure the final processed result is a dict
.
Also, since there may be network errors in some regions, I have added some code to handle APITimeoutError(shown in image):
You can use the code from [scripts/gpt_anno/gpt_query_mat.py]() as a simple test for GPT-4V connection, or provide more error information about this issue.
A runtime error occurs at every
json.loads(response.json())
becausejson.loads()
isstr->dict
butresponse.json()
already returns adict
. Please fix it soon. Thank you!