jjz5463 commited on
Commit
5b69386
·
1 Parent(s): 085e218

update user description

Browse files
Files changed (1) hide show
  1. baseline_utils.py +22 -9
baseline_utils.py CHANGED
@@ -42,15 +42,28 @@ def analyze_writer_image(image_path, api_key):
42
  genai.configure(api_key=api_key)
43
  model = genai.GenerativeModel("gemini-1.5-flash")
44
  myfile = genai.upload_file(image_path)
45
- result = model.generate_content(
46
- [myfile,
47
- "Provide a detailed description of the people in the picture by completely transforming them into a spiritual or symbolic animal. "
48
- "Do not describe them as humans; instead, fully embody them as an animal. Describe their appearance, personality, and mood "
49
- "as if they were this animal. For example, if someone has calm and gentle features, you might describe them as a panda. "
50
- "Ensure that the entire description is centered on their transformation into this animal, using vivid and expressive language, "
51
- "but without mentioning them as a person at all. Keep the description concise, without line breaks or unnecessary characters."]
52
- )
53
- return result.text
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
 
56
  def break_diary_to_scenes(diary_text, writer_description, api_key):
 
42
  genai.configure(api_key=api_key)
43
  model = genai.GenerativeModel("gemini-1.5-flash")
44
  myfile = genai.upload_file(image_path)
45
+ # result = model.generate_content(
46
+ # [myfile,
47
+ # "Provide a detailed description of the people in the picture by completely transforming them into a spiritual or symbolic animal. "
48
+ # "Do not describe them as humans; instead, fully embody them as an animal. Describe their appearance, personality, and mood "
49
+ # "as if they were this animal. For example, if someone has calm and gentle features, you might describe them as a panda. "
50
+ # "Ensure that the entire description is centered on their transformation into this animal, using vivid and expressive language, "
51
+ # "but without mentioning them as a person at all. Keep the description concise, without line breaks or unnecessary characters."]
52
+ # )
53
+ color = model.generate_content([myfile,"What is the predominant color of the person in the image?"])
54
+ description = f"""
55
+ The writer is a cartoonish, fluffy cat with large, expressive blue eyes.
56
+ Its fur is predominantly {color}, with subtle shading on certain parts of its body in a slightly darker or lighter shade of {color}.
57
+ The face is round with soft, slightly pointed ears that are highlighted with an inner coloring also in {color}.
58
+
59
+ The most prominent feature of the cat is its extremely fluffy, oversized tail, which arcs gracefully above its body.
60
+ The tail fur is thick, feathery, and has a luxurious texture that stands out against the rest of the body, showcasing
61
+ a gradient effect from darker to lighter shades of {color} at the edges.
62
+
63
+ The cat’s paws are small and round, with shading in a slightly darker shade of {color}.
64
+ The overall look of the figure is cute, gentle, and meticulously detailed, emphasizing a soft and playful appearance.
65
+ """
66
+ return description#result.text
67
 
68
 
69
  def break_diary_to_scenes(diary_text, writer_description, api_key):