AttributeError: 'NoneType' object has no attribute 'from_call'

Hi,

I am getting the AttributeError: ‘NoneType’ object has no attribute ‘from_call’.
When running the following sample code.
It did work before but then stopped and all attempts result with this error.

Sample Code:
import google.generativeai as genai

import PIL.Image

API_KEY = ‘My Key’

genai.configure(api_key=API_KEY)

model = genai.GenerativeModel(“gemini-1.5-flash”)

organ = PIL.Image.open(‘My Path’)

response = model.generate_content([“Tell me about this instrument”, organ])

print(response.text)

Hi @Vladimir_Bershtein, I have tried to reproduce the issue by passing an image to the 1.5-flash model along with the prompt. I got this error but after some retries by model I got the response.

Gemini 1.5-flash Output

ERROR:tornado.access:503 POST /v1beta/models/gemini-1.5-flash:generateContent?%24alt=json%3Benum-encoding%3Dint (127.0.0.1) 1241.74ms
ERROR:tornado.access:503 POST /v1beta/models/gemini-1.5-flash:generateContent?%24alt=json%3Benum-encoding%3Dint (127.0.0.1) 1215.32ms
ERROR:tornado.access:503 POST /v1beta/models/gemini-1.5-flash:generateContent?%24alt=json%3Benum-encoding%3Dint (127.0.0.1) 1012.27ms
ERROR:tornado.access:503 POST /v1beta/models/gemini-1.5-flash:generateContent?%24alt=json%3Benum-encoding%3Dint (127.0.0.1) 1063.83ms
ERROR:tornado.access:503 POST /v1beta/models/gemini-1.5-flash:generateContent?%24alt=json%3Benum-encoding%3Dint (127.0.0.1) 1063.48ms
That's a simplified diagram of the human brain showing its major lobes.  It's a lateral view (a side view, as if looking at someone's brain from the side).  The lobes are color-coded for easy identification.  While not precisely anatomically accurate in its borders, it provides a good general overview of the lobes' relative positions.

Here's what the colors likely represent (note that the exact color-lobe assignment can vary depending on the source):

So I tried with another model and it worked as expected. Please refer to this gist.

I recommend you to try with a different model.Thank You.

I need this model. I have used it for a full day. I made most probably hundreds of tests.
It has done a phenomenal job that other models didn’t.
It was working flawlessly. Then it just stopped.

Hi @Vladimir_Bershtein, I have tried to use the gemini-1.5-flash model by passing the prompt along with the image. It is working fine now. Could you please try it on your side and let us know if the issue got resolved or not. Thank You.