metadata
{}
ViPer: Metric
GitHub: https://github.com/sogandstorme/ViPer_Personalization
Example
To use ViPer, start by cloning it from our GitHub page. For effective personalization, we recommend commenting on at least eight images.
git clone https://github.com/sogandstorme/ViPer_Personalization.git
cd ViPer_Personalization
from ViPer import (
set_device,
load_images,
initialize_processor_and_model,
prepare_prompt_and_inputs,
generate_texts,
extract_features,
initialize_pipelines,
generate_images
)
# Ensure that the order of the comments matches the path of the images they refer to.
comments = [
"These are beautiful, intricate patterns. Very elegant, and the teal blue colors are lovely. I love the flowing lines.",
"The colors here don't quite work for me. They feel a bit unmatched and artificial. The concept also seems a bit boring and artificial to me.",
]
image_paths = [
"/images/6.png",
"/images/9.png"
]
prompts = [
"Whimsical tea party in a bioluminescent forest",
"Tiny houses on top of each other above clouds"
]
output_dir = "results/"
device = set_device("cuda:0")
# Initialize processor, model and inputs
images = load_images(image_paths)
processor, model = initialize_processor_and_model(device)
inputs = prepare_prompt_and_inputs(processor, images, comments)
# Generate and extract vp
generated_texts = generate_texts(processor, model, inputs)
vp_pos, vp_neg = extract_features(generated_texts)
# Initialize pipelines and generate images
pipe, refiner = initialize_pipelines(device)
generate_images(pipe, refiner, prompts, vp_pos, vp_neg, output_dir)