Aleafy / Make_it_Real

[NeurIPS 2024] Make-it-Real: Unleashing Large Multimodal Model for Painting 3D Objects with Realistic Materials
https://sunzey.github.io/Make-it-Real/
MIT License
147 stars 3 forks source link

Runtime error in utils/gpt4_query.py #6

Open WilliamHaiweiGu opened 3 months ago

WilliamHaiweiGu commented 3 months ago

A runtime error occurs at every json.loads(response.json()) because json.loads() is str->dict but response.json() already returns a dict. Please fix it soon. Thank you!

Aleafy commented 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.

connect1

Aleafy commented 3 months ago

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.

api_test