|
|
import os |
|
|
import random |
|
|
import gradio as gr |
|
|
from smolagents import InferenceClientModel |
|
|
|
|
|
HF_TOKEN = os.getenv("HF_TOKEN") |
|
|
|
|
|
|
|
|
model = InferenceClientModel( |
|
|
model_id="mistralai/Mistral-7B-Instruct-v0.1", |
|
|
token=HF_TOKEN, |
|
|
) |
|
|
|
|
|
|
|
|
ROLES = [ |
|
|
"nurse", "nun", "doctor", "secretary", "teacher", "schoolgirl", "lawyer" |
|
|
] |
|
|
|
|
|
HAIR_STYLES = [ |
|
|
"long flowing chestnut hair styled in soft waves", |
|
|
"sleek straight long black hair", |
|
|
"luxurious long blonde curls", |
|
|
] |
|
|
|
|
|
EYE_COLORS = [ |
|
|
"intense brown", "bright sapphire blue", "emerald green" |
|
|
] |
|
|
|
|
|
OUTFIT_TEMPLATES = { |
|
|
"nurse": "a classic short nurse dress, thigh-high stockings, semi-transparent lace panties, no bra, elegant high heels", |
|
|
"nun": "a sensual interpretation of a nun's habit with a revealing long robe and thigh-high stockings", |
|
|
"doctor": "a daring white lab coat minidress left slightly open, thigh-high stockings", |
|
|
"secretary": "a provocative office pencil skirt and sheer blouse, thigh-high stockings", |
|
|
"teacher": "a fitted blazer over a silk blouse and short skirt, thigh-high stockings", |
|
|
"schoolgirl": "a short pleated skirt and white blouse, thigh-high stockings", |
|
|
"lawyer": "a tailored suit with skirt cut above knees, silk blouse unbuttoned slightly, thigh-high stockings" |
|
|
} |
|
|
|
|
|
POSES = [ |
|
|
"standing gracefully with one leg slightly forward", |
|
|
"seated on the edge, legs crossed", |
|
|
"bending forward slightly as if picking something up" |
|
|
] |
|
|
|
|
|
SETTINGS = [ |
|
|
"a modern professional office with golden sunset light and sophisticated decor", |
|
|
"a stylish hospital room with clean bright tones and realistic medical equipment", |
|
|
"a luxurious bedroom with silk sheets and soft lighting" |
|
|
] |
|
|
|
|
|
ATMOSPHERES = [ |
|
|
"soft professional lighting with perfect color, crisp highlights and smooth skin shadows", |
|
|
"warm ambient sunlight, rich gold reflections and depth", |
|
|
"moody cinematic lighting with dramatic shadows and highlights" |
|
|
] |
|
|
|
|
|
TECHNICAL_DETAILS = ( |
|
|
"shot in full vertical 9:16 aspect ratio capturing the entire figure with natural human proportions and anatomical precision, " |
|
|
"featuring hyperrealistic skin texture with subtle imperfections, perfect makeup and natural fabric and hair strand details. " |
|
|
"Captured with professional camera gear (Canon R5, 85mm lens, f/1.2) emphasizing soft, natural lighting and highlights for humanized photorealism. " |
|
|
"Exclude any cartoon, 2D, painting, stylized, CGI, low resolution or watermark artifacts." |
|
|
) |
|
|
|
|
|
|
|
|
def generate_prompt(): |
|
|
role = random.choice(ROLES) |
|
|
hair_style = random.choice(HAIR_STYLES) |
|
|
eye_color = random.choice(EYE_COLORS) |
|
|
outfit = OUTFIT_TEMPLATES[role] |
|
|
pose = random.choice(POSES) |
|
|
setting = random.choice(SETTINGS) |
|
|
atmosphere = random.choice(ATMOSPHERES) |
|
|
|
|
|
prompt_text = ( |
|
|
f"A hyperrealistic full-body portrait of a sensual {role} with {hair_style} and {eye_color} eyes, " |
|
|
f"perfect makeup and flawless skin with subtle natural imperfections. Wearing {outfit}. " |
|
|
f"Pose: {pose}. Scene: {setting} with {atmosphere}. " |
|
|
f"{TECHNICAL_DETAILS}" |
|
|
) |
|
|
|
|
|
return f"``````" |
|
|
|
|
|
|
|
|
def generate_five_prompts(): |
|
|
return [generate_prompt() for _ in range(5)] |
|
|
|
|
|
|
|
|
with gr.Blocks() as demo: |
|
|
gr.Markdown("## Hyperrealistic Full-Body Prompt Generator") |
|
|
output = gr.Textbox(label="Generated Prompts", lines=20) |
|
|
btn = gr.Button("Generate 5 Prompts") |
|
|
|
|
|
btn.click(fn=lambda: "\n\n".join(generate_five_prompts()), outputs=output) |
|
|
|
|
|
if __name__ == "__main__": |
|
|
demo.launch() |
|
|
|