Doriandarko / gemini-ui-to-code

A Streamlit application to generate code from images
523 stars 124 forks source link

Modify send_message_to_model to take advantage of conversation history #3

Closed 3choff closed 4 weeks ago

3choff commented 1 month ago

Hi,

I am working on something similar and noticed that in your code, you are re-sending the image with each request. I suggest taking advantage of the conversation history and sending the image only on the first request. In this pull request, I modified the send_message_to_model function to handle an optional image_path parameter and utilize the image in the chat history for the other requests. With this approach, the image is sent just at the beginning, simplifying the code and, in theory, improving response speed.

Let me know if you have considered this approach and if you think it is a viable solution.