ниже приведен код
Код: Выделить всё
sample_file = genai.upload_file(path=image_path,display_name=image_path)
print(f"Uploaded file '{sample_file.display_name}' as: {sample_file.uri}")
model = genai.GenerativeModel(model_name="models/gemini-1.5-pro-latest")
response = model.generate_content(["Generate the tags for the given image. Provide all the information in JSON format.", sample_file])
Подробнее здесь: https://stackoverflow.com/questions/787 ... source-has