import os | |
import json | |
import google.generativeai as genai | |
from PIL import Image | |
#loading the API key | |
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY") | |
genai.configure(api_key= GOOGLE_API_KEY) | |
#function to load gemini pro model | |
def load_gemini_pro(): | |
gemini_pro_model = genai.GenerativeModel("gemini-1.5-flash") | |
return gemini_pro_model | |
# Function to load image vision model | |
def gemini_pro_vision_responce(prompt, image): | |
gemini_pro_vision_model = genai.GenerativeModel("gemini-1.5-pro") | |
responce = gemini_pro_vision_model.generate_content([prompt, image]) | |
result = responce.text | |
return result | |