Gemini Pro Vision Image Analysis Project πŸ“·

parmarjatin4911@gmail.com - Jan 11 - - Dev Community

This project involves leveraging the powerful capabilities of the Gemini Pro Vision Model for comprehensive image analysis. Through a user-friendly web interface, users can upload images, triggering a backend process that utilizes the Gemini Pro Vision Model to provide insightful analysis. The results, ranging from object detection to intricate details, are then presented to the user, enhancing their understanding of the uploaded images.

Implementation code

Now, let's dive into the implementation. We'll use Python and streamlit to local interface and easy upload an image and Image Analysis Below is a simple Python script for Gemini Pro Vision Image Analysis Project:

CODE

import streamlit as st

import google.generativeai as genai

import google.ai.generativelanguage as glm

from PIL import Image

API_KEY = ''

genai.configure(api_key=API_KEY)

st.set_page_config(page_title="Gemini Pro Vision Image Analysis Project" ,page_icon="πŸ“Έ", layout="centered", initial_sidebar_state='collapsed')

st.header("Google AI Studio + Gemini Pro")

uploaded_file = st.file_uploader("Choose an Image file", accept_multiple_files=False, type=['jpg', 'png'])

if uploaded_file is not None:

image = Image.open(uploaded_file)

st.image(image, caption='Uploaded Image', use_column_width=True)

bytes_data = uploaded_file.getvalue()

generate = st.button("Generate!")

if generate:

model = genai.GenerativeModel('gemini-pro-vision')

response = model.generate_content(glm.Content(parts = [glm.Part(text="Write a short, you know this? what is this?"),glm.Part(inline_data=glm.Blob(mime_type='image/jpeg', data=bytes_data )),], ),stream=True)

response.resolve()

st.write(response.text)

Save the above script as a Python file (e.g., streamlit run app.py ) and run it on your os system . The script upload iamge from the machine, performs analyze images , and displays the live feedback.

Conclusion

As we conclude this exploration, we celebrate the marriage of cutting-edge technology and user- centric design. The Gemini Pro Vision Model opens a new frontier, where users seamlessly navigate the intricacies of image analysis. This project is not just about technology; it's a testament to the transformative power of models like Gemini Pro, where every image tells a story waiting to be discovered. Join us on this exhilarating journey into the depths of visual intelligence. As we continue to push the boundaries of AI applications, Gemini Pro stands as a symbol of what's possible when innovation and accessibility converge.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player