|
import vertexai |
|
from vertexai.generative_models import GenerativeModel, Image |
|
|
|
import os |
|
|
|
PROJECT_ID = "agileai-poc" |
|
REGION = "us-central1" |
|
vertexai.init(project=PROJECT_ID, location=REGION) |
|
|
|
|
|
IMAGE_FILE = "/home/lenovo/Pictures/palette_samples/3.jpg" |
|
image = Image.load_from_file(IMAGE_FILE) |
|
|
|
|
|
|
|
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 hexacode ************************************** \n") |
|
response2 = generative_multimodal_model.generate_content([prompt2, image]) |
|
print(response2.text) |