Hello I want give you an error I encountered randomly with same image
Hi there!
Here is error when submission of image is down,
Blip2-opt-2.7b accepted it and passed a prompted first caption to Google Gemini API.
But then, Google Gemini API returned thzt issue.
Issue:
{
list index out of range
Error when calling Gemini API
}
Reason:
{
Two possible reasons :
1.
The Google API server (Gemini)
went on timeout
2.
Google API (Gemini) refused and blocked
the prompt.
}
Note:
{
Also once that issue is produced,
trying to republish the same image
(from the Streamlit ui) is causing that "image" python argument is emptied when passed to text_2_caption() class method in CaptionsGenerator.py
As my images submitted are SFW,
Then I assume the issue is
more related to case #1.
Finally, once that issue occurs, the only way to get the Streamlit ui accepting to re-submit image to Google API (Gemini) is to hard-reload the Space page!
I must say also that the issue randomly occurs, because submitting by insisting the same image it ends up passing with success.
}
By the way, great tool.
Thank you for highlighting the bug that occurs after the error. I'm currently working on refactoring the code to ensure all values are properly cleared from the session state whenever a new upload takes place.
Cause for error list index out of range
The error displayed before this bug is produced, reads Error when calling Gemini API
so the image description appears successful. I did test the image and based on the BLIP-2 description I am leaning towards Google API (Gemini) refused and blocked the prompt . Although the image is SFW, the description generated is "a women's bra" and Gemini might refuse to generate captions due to the probability of it being an inappropriate image. This is a limitation of the model and not the app. I will explore solutions so the app does not crash when Gemini blocks a prompt.
Bug after issue is produced
It appears that old values persisting are causing a crash, resulting in a hard restart of the application as the only solution. I'm working on fixing the handling of session state by clearing and reprocessing only the necessary components.