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