Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -13,12 +13,13 @@ GENERAL_PROMPT_TEMPLATE = jinja2.Template("""You are an expert prompt engineer f
|
|
13 |
|
14 |
Transform the user's simple prompt into a highly descriptive paragraph that produces a visually striking image. The photo of the user will be provided to you, so you should use it to infer the subject's appearance and incorporate accurate descriptors.
|
15 |
|
16 |
-
|
17 |
|
18 |
Tips:
|
19 |
- Make sure prompt is not too long.
|
20 |
- Only include facial features of the subject in the prompt from the photo. Ignore the background or the clothes of the subject in the photo.
|
21 |
- Use dynamic camera angles and poses if appropriate.
|
|
|
22 |
|
23 |
Examples:
|
24 |
Input: A photo of me in a race bib
|
@@ -66,6 +67,141 @@ HERE is the user's prompt:
|
|
66 |
{{ user_prompt }}
|
67 |
""")
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
def process_prompt(image, target_label, user_prompt, style):
|
70 |
image_url = None
|
71 |
|
@@ -88,10 +224,14 @@ def process_prompt(image, target_label, user_prompt, style):
|
|
88 |
f"User's prompt: {user_prompt}"
|
89 |
)
|
90 |
|
91 |
-
elif style == "General":
|
92 |
system_content = "You are expert prompt engineer"
|
93 |
user_content = GENERAL_PROMPT_TEMPLATE.render(user_prompt=user_prompt)
|
94 |
|
|
|
|
|
|
|
|
|
95 |
|
96 |
response = client.responses.create(
|
97 |
model="gpt-5",
|
@@ -128,7 +268,7 @@ demo = gr.Interface(
|
|
128 |
placeholder="picture of me while sitting in a chair in the ocean",
|
129 |
),
|
130 |
gr.Dropdown(
|
131 |
-
choices=["General"],
|
132 |
#choices=["Chromatic Cinematic", "Neon Noir", "General"],
|
133 |
label="Style Selection",
|
134 |
info="Choose the visual style for your enhanced prompt"
|
|
|
13 |
|
14 |
Transform the user's simple prompt into a highly descriptive paragraph that produces a visually striking image. The photo of the user will be provided to you, so you should use it to infer the subject's appearance and incorporate accurate descriptors.
|
15 |
|
16 |
+
Focus heavily on lighting, composition, and color to sculpt form and mood, using multiple light sources, attractive color contrasts, and interesting angles. Choose the artistic style, color grading, and atmosphere that best enhance the subject and context of the prompt, creating a cohesive and visually compelling image. Make sure that the background is very cool and suits the prompt. Make sure that the prompt is very aesthetic, creative and vivid.
|
17 |
|
18 |
Tips:
|
19 |
- Make sure prompt is not too long.
|
20 |
- Only include facial features of the subject in the prompt from the photo. Ignore the background or the clothes of the subject in the photo.
|
21 |
- Use dynamic camera angles and poses if appropriate.
|
22 |
+
- **You are creating art** There should be a distinct style and aesthetic to the prompt. The generated image should be something that could be printed on a poster. Have a surprise factor.
|
23 |
|
24 |
Examples:
|
25 |
Input: A photo of me in a race bib
|
|
|
67 |
{{ user_prompt }}
|
68 |
""")
|
69 |
|
70 |
+
|
71 |
+
FASHION_PROMPT_TEMPLATE = jinja2.Template("""Generate a striking fashion editorial photograph with strong conceptual impact and visual
|
72 |
+
distinction. Focus on capturing a model in a powerful pose or moment that showcases both
|
73 |
+
their features and the styling elements (clothing, accessories, makeup) in a compelling context.
|
74 |
+
context. Utilize bold lighting techniques (e.g., hard shadow play, colored gels, dramatic
|
75 |
+
high-key or low-key setups) and innovative composition (e.g., unconventional cropping,
|
76 |
+
extreme perspectives, symmetry/asymmetry) to create a distinctive mood. Incorporate
|
77 |
+
environmental elements or props that enhance the narrative. The final image should balance
|
78 |
+
artistic expression with commercial appeal, conveying a specific attitude, concept, or
|
79 |
+
emotional tone while maintaining the fashion focus.
|
80 |
+
Analysis:
|
81 |
+
Fashion editorial prompts aim to create images with both artistic and commercial value.
|
82 |
+
Success often comes from a precise balance of styling details, environmental context, and
|
83 |
+
technical elements like lighting and composition. Strong concepts and bold visual choices
|
84 |
+
typically yield the most compelling results. Describing makeup, accessories, and specific
|
85 |
+
fashion elements in detail helps the AI create cohesive styling.
|
86 |
+
Tips for Success:
|
87 |
+
● Specify the precise styling (clothing items, fabrics, colors, fit, accessories)
|
88 |
+
● Detail the model's features and pose (expression, positioning, gesture)
|
89 |
+
● Describe the makeup and hair with specificity (textures, colors, style)
|
90 |
+
● Define the lighting setup (direction, quality, color, shadow effects)
|
91 |
+
● Include props or environmental elements that enhance the concept
|
92 |
+
● Suggest a brand or editorial reference for stylistic guidance
|
93 |
+
● Add compositional directions (framing, cropping, perspective)
|
94 |
+
Key Keywords:
|
95 |
+
fashion editorial, fashion photography, studio photography, location editorial, model pose,
|
96 |
+
conceptual fashion, striking composition, dramatic lighting, hard light, soft light, colored gels,
|
97 |
+
editorial makeup, fashion styling, haute couture, ready-to-wear, fashion concept, art
|
98 |
+
direction, commercial appeal, [brand reference]
|
99 |
+
|
100 |
+
|
101 |
+
Examples:
|
102 |
+
|
103 |
+
Prompt 1 (OHNEIS Runner):
|
104 |
+
|
105 |
+
Output prompt:
|
106 |
+
A stylized, cinematic portrait of a Black man captured from the chest up, set against a
|
107 |
+
glowing deep red background. The image is tightly framed in vertical format, emphasizing his
|
108 |
+
upper torso, neck, and face in moody, directional light. He wears a torn black tank top with
|
109 |
+
rugged edges and a marathon race bib pinned to the front reading "69" with the word
|
110 |
+
"OHNEIS" printed boldly underneath. Around his neck hangs a thin silver chain. His hair is
|
111 |
+
styled in tight braids, and he wears futuristic wraparound sunglasses in metallic blue, with
|
112 |
+
the word "ohneis" engraved across the lens — subtly visible in the reflections. The lighting is
|
113 |
+
soft but focused, casting strong shadow contours along his collarbone and highlighting the
|
114 |
+
reflective elements of both glasses and sweat on his skin. The mood is intense and editorial
|
115 |
+
— a blend of raw athleticism and streetwear elegance, evoking focus, style, and subtle
|
116 |
+
rebellion. The torn shirt and race bib hint at exertion and context, while the engraved
|
117 |
+
eyewear and red glow turn the portrait into a branded fashion statement.
|
118 |
+
Sora Companion Prompt: A high-impact, vertically framed editorial portrait of a male
|
119 |
+
runner against a rich red backdrop. The athlete wears a distressed black tank top with a torn
|
120 |
+
collar and a large pinned-on race number reading "69" above the bold white word "OHNEIS"
|
121 |
+
in a rectangular black bar. His face is partially shadowed, lit with cinematic precision that
|
122 |
+
accentuates the contours of his skin and shoulders. He wears reflective blue OHNEIS sports
|
123 |
+
sunglasses with the brand name clearly legible across the lens. His expression is stoic,
|
124 |
+
exuding focus and control. The image balances a gritty, competitive energy with futuristic
|
125 |
+
fashion elements and controlled studio lighting.
|
126 |
+
|
127 |
+
● Analysis: This prompt masterfully blends fashion and athletic elements. The detailed
|
128 |
+
styling (torn tank top, race bib, metallic sunglasses) creates brand identity. Specific
|
129 |
+
lighting directions (soft but focused, shadow contours) shape the mood. The Sora
|
130 |
+
prompt maintains the exact styling while adding subtle emotional elements (stoic
|
131 |
+
expression, focus and control) for video continuity.
|
132 |
+
|
133 |
+
● Variations & Keywords: Try different backgrounds (urban setting, abstract color
|
134 |
+
field), lighting scenarios (harsh backlight, cool blue tones), model demographics, or
|
135 |
+
accessories (compression sleeves, techwear). Keywords: athletic fashion, editorial
|
136 |
+
portrait, directional lighting, race bib, futuristic eyewear, brand styling, reflective
|
137 |
+
elements, torn fabric, cinematic portrait, color-blocking.
|
138 |
+
|
139 |
+
Prompt 2 (Sprinting Runner):
|
140 |
+
Output prompt:
|
141 |
+
A vertical-format, side-profile flash photograph capturing a Black male runner sprinting
|
142 |
+
down a sunlit urban street from an elevated angle. The camera looks slightly down at the
|
143 |
+
scene, placing the runner in the center-right of the frame, mid-stride with one leg extended
|
144 |
+
behind and arms pumping forward. He wears a reflective silver windbreaker, black running
|
145 |
+
shorts, white socks, and sleek performance shoes. A pair of dark sunglasses adds attitude
|
146 |
+
and edge to his motion.
|
147 |
+
The runner is in motion blur, especially on limbs and head, with only parts of the torso and
|
148 |
+
upper back lightly frozen by a directional rear-curtain sync flash. His movement arcs forward
|
149 |
+
across the frame, and the reflective jacket catches intense flashes of light, bouncing subtle
|
150 |
+
highlights across the scene. Below the asphalt road, a strip of green grass borders the
|
151 |
+
street at the bottom edge of the image, adding a clean contrasting base to the composition.
|
152 |
+
The background is dark asphalt, textured with faint painted lines and subtle shadows. The
|
153 |
+
elevated camera position allows for a sense of depth and rhythm as the runner cuts across
|
154 |
+
the frame from left to right, motion trailing behind. Warm natural light streaks or golden
|
155 |
+
ambient flares may bleed across the top of the image for added cinematic tension.
|
156 |
+
● Analysis: This prompt creates dynamic motion through specific technical directions
|
157 |
+
(rear-curtain sync flash, motion blur). The clothing details (reflective silver
|
158 |
+
windbreaker) add visual interest through light interaction. The composition
|
159 |
+
instructions (elevated angle, center-right placement) guide spatial understanding.
|
160 |
+
Environmental elements (grass strip, asphalt texture) add realism and grounding.
|
161 |
+
|
162 |
+
● Variations & Keywords: Change the setting (beach, track, trail), lighting (twilight,
|
163 |
+
rainy day), clothing (branded apparel, minimal gear), or technique (front-curtain sync,
|
164 |
+
pan blur). Keywords: sports fashion, running, motion photography, rear-curtain sync,
|
165 |
+
flash photography, reflective materials, urban environment, elevated angle, side
|
166 |
+
profile, dynamic pose, directional movement.
|
167 |
+
|
168 |
+
Prompt 3 (Track Athlete):
|
169 |
+
|
170 |
+
Output prompt:
|
171 |
+
A flash-illuminated, hyper-dynamic close-up photograph capturing the feet of a Black
|
172 |
+
female track runner launching from the starting blocks at night. The image is taken from a
|
173 |
+
low, side angle, tightly framed at ground level, with her silver sprinting spikes clearly
|
174 |
+
visible — one foot pushing forcefully into the rear block, the other caught mid-air in dramatic
|
175 |
+
motion. She wears white ankle-high performance socks, and her defined, muscular
|
176 |
+
calves are frozen in the peak of exertion.
|
177 |
+
The flash lighting from the front-left casts sharp highlights on her skin and the metallic
|
178 |
+
texture of the shoes, while the surrounding track surface — deep blue and textured —
|
179 |
+
catches scattered moisture droplets that shimmer in the light. The starting blocks behind
|
180 |
+
her blur slightly, and her trailing leg dissolves into motion streaks, captured using a slow
|
181 |
+
shutter speed with rear-curtain sync to enhance the sense of explosive movement.
|
182 |
+
The background is minimal and moody: abstract light streaks from stadium lighting stretch
|
183 |
+
diagonally behind her, forming a glowing contrast to the dark track. The overall tone is sleek,
|
184 |
+
raw, and cinematic — focused on power, speed, and launch precision.
|
185 |
+
|
186 |
+
● Analysis: This prompt uses extreme close-up composition to transform a sports
|
187 |
+
moment into fashion art. The visual contrast between static elements (starting blocks,
|
188 |
+
track surface) and dynamic elements (mid-air foot, motion streaks) creates tension.
|
189 |
+
Technical specifications (flash from front-left, slow shutter, rear-curtain sync) guide
|
190 |
+
the lighting and motion effects precisely. Texture details (moisture droplets, metallic
|
191 |
+
shoes) add depth and realism.
|
192 |
+
|
193 |
+
● Variations & Keywords: Try different sports (swimming dive, basketball jump shot),
|
194 |
+
perspectives (from front, from above), lighting (daylight, colored gels), or focusing on
|
195 |
+
different body parts (hands, torso). Keywords: athletic footwear, sprinting spikes,
|
196 |
+
track and field, starting blocks, flash photography, low angle, extreme close-up,
|
197 |
+
rear-curtain sync, moisture droplets, motion blur, explosive movement, performance
|
198 |
+
apparel.
|
199 |
+
|
200 |
+
You need to enhance the following prompt according to the guide above. Only output the prompt, no other text.
|
201 |
+
{{ user_prompt }}
|
202 |
+
""")
|
203 |
+
|
204 |
+
|
205 |
def process_prompt(image, target_label, user_prompt, style):
|
206 |
image_url = None
|
207 |
|
|
|
224 |
f"User's prompt: {user_prompt}"
|
225 |
)
|
226 |
|
227 |
+
elif style == "General":
|
228 |
system_content = "You are expert prompt engineer"
|
229 |
user_content = GENERAL_PROMPT_TEMPLATE.render(user_prompt=user_prompt)
|
230 |
|
231 |
+
elif style == "Fashion":
|
232 |
+
system_content = "You are expert prompt engineer"
|
233 |
+
user_content = FASHION_PROMPT_TEMPLATE.render(user_prompt=user_prompt)
|
234 |
+
|
235 |
|
236 |
response = client.responses.create(
|
237 |
model="gpt-5",
|
|
|
268 |
placeholder="picture of me while sitting in a chair in the ocean",
|
269 |
),
|
270 |
gr.Dropdown(
|
271 |
+
choices=["General", "Fashion"],
|
272 |
#choices=["Chromatic Cinematic", "Neon Noir", "General"],
|
273 |
label="Style Selection",
|
274 |
info="Choose the visual style for your enhanced prompt"
|