Send an Image as a Prompt to Gemini using the API

I have watched the very well crafted tutorial on “How To Use Gemini API” and it was worked extremely well for text inputs.

However, now I want to upload images to the Gemini API. How do i achieve this?
I am not sure how to send an image to the API and then get the required output because the prompt should be IMAGE + TEXT together.

Can someone please advise me on this?

Thank you.
Regards,
Varun Kadapatti

Can someone please guide me as to how to achieve this if possible?
Sending a link for the picture does not work…

Could you link the documentation from Google for uploading images on Gemini?

Yes! Here are the links to the same.
File prompting strategies | Gemini API | Google AI for Developers

Explore vision capabilities with the Gemini API | Google AI for Developers

Thank you!

Hello, I’ve made few advancements in trying to prompt Gemini with images using the Gemini API.
This is the JSON code I have used in the Web API’s Body.
However, it always returns a “null” value for some reason as the output.
After investigating in Google Cloud Console, it seems that the Gemini API does not receive the request at all.
I have ensured that the API key is up-to-date and it is functioning in my other use cases.
Please can someone guide me on this.
Thank you.

WEB API BODY:
{
“contents”: [
{
“role”: “user”,
“parts”: [
{
“fileData”: {
“fileUri”: “Imgur: The magic of the Internet”,
“mimeType”: “image/jpeg”
}
},
{
“text”: “Please solve this mathematics question”
}
]
}
],
“generationConfig”: {
“temperature”: 1,
“topK”: 64,
“topP”: 0.95,
“maxOutputTokens”: 8192,
“responseMimeType”: “text/plain”
}
}

For context I am making an AI Math question solver