content_mod / color_palette.py
SaiLochana's picture
Upload 2 files
d548309 verified
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)