File size: 1,487 Bytes
d548309
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import vertexai
from vertexai.generative_models import GenerativeModel, Image
# import streamlit as st
import os 

PROJECT_ID = "agileai-poc"
REGION = "us-central1"
vertexai.init(project=PROJECT_ID, location=REGION)
# upload_image = st.file_uploader("Upload an image", type=["jpeg","png","jpg"],accept_multiple_files=True)
# print(upload_image)
IMAGE_FILE = "/home/lenovo/Pictures/palette_samples/3.jpg"
image = Image.load_from_file(IMAGE_FILE)
# if upload_image:
#     image = Image.load_from_file(upload_image)

generative_multimodal_model = GenerativeModel("gemini-1.0-pro-vision")
prompt=""""  Describe the desired theme,or brand,mood,and palette,detect objects and generate the appealing color palettes on image with respective object and rgb code "
output format should be "object name :rgb code"

example:
tree leaf: (0,255,0)
pillow :(12,0,230)
"""
prompt2=""""  Describe the desired theme,or brand,mood,and palette,detect objects with 100 percent accuracy and generate the appealing color palettes on image with respective object ,color name and hexacode "
output format should be "object name : color :hexacode"

example:
object_name :color :(hexacode)
"""

# print("\n RGB ************************************** \n")
# response1 = generative_multimodal_model.generate_content([prompt, image])
# print(response1.text)
print("\n hexacode ************************************** \n")
response2 = generative_multimodal_model.generate_content([prompt2, image])
print(response2.text)