Spaces:
Sleeping
Sleeping
File size: 1,009 Bytes
f96b00a acfddab c51708f f96b00a c51708f acfddab bb3134a f96b00a acfddab |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
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
|