File size: 615 Bytes
88e692a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
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
|