subashpoudel's picture
next
bb3134a
from google import genai
from google.genai import types
import os
from ..utils.prompts import analytics_description_prompt
from dotenv import load_dotenv
load_dotenv()
os.environ['GOOGLE_API_KEY']=os.getenv('GOOGLE_API_KEY')
# def analytics_description_prompt(query):
# return f'''
# You are provided with the user query and the image.
# Give clear information to the user for their query only by analyzing the image. Don't give any responses outside of the image's context.
# The user query is: \n{query}\n
# '''
def generate_analytics_description(query,image_base64):
if image_base64=='string':
return None
client = genai.Client()
response = client.models.generate_content(
model='gemini-2.5-flash',
contents=[
types.Part.from_bytes(
data=image_base64,
mime_type='image/jpeg',
),
analytics_description_prompt(query)
]
)
print('The image description:', response.text)
return response.text