Skip to content

Commit 09abf53

Browse files
authored
Update 4-AI_image_multimodal_location_GPT.R
Correction of error on text generation when filesize is bigger than 4Mb (Azure's limit)
1 parent ccdbbdc commit 09abf53

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

4-AI_image_multimodal_location_GPT.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,12 @@ if (file.size(image_path)>4150000){ # needed?
724724
}
725725

726726
# Describe the image using Azure AI:
727-
text <- analyze(vis, image_path, domain = "landmarks", feature_types = "description")$description$captions$text
727+
if (file.size(image_path)>4150000){ # needed?
728+
text <- analyze(vis, raw_vector, domain = "landmarks", feature_types = "description")$description$captions$text
729+
} else {
730+
text <- analyze(vis, image_path, domain = "landmarks", feature_types = "description")$description$captions$text
731+
}
732+
728733

729734
# Define a string for the Bing Chat prompt, that will generate the text for the social media post. Feel free to change this to your liking
730735
str <- ""

0 commit comments

Comments
 (0)