seawolf2357 commited on
Commit
e5c3e33
·
verified ·
1 Parent(s): 8943855

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +77 -46
app.py CHANGED
@@ -70,6 +70,41 @@ def maybe_translate(text: str) -> str:
70
  print("[WARN] Translation failed at runtime →", e)
71
  return text
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  # ------------------------------------------------------------
74
  # LLM PROMPT GENERATOR
75
  # ------------------------------------------------------------
@@ -181,15 +216,40 @@ def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance
181
  print(f"[ERROR] Diffusion failed → {e}")
182
  return Image.new("RGB", (width, height), color=(0, 0, 0)), seed
183
 
 
 
 
 
184
  # ------------------------------------------------------------
185
- # UI LAYOUT + THEME (Pastel Lavender Background)
186
  # ------------------------------------------------------------
187
  css = """
188
- body {background: #f2f1f7; color: #222; font-family: 'Noto Sans', sans-serif;}
189
- #col-container {margin: 0 auto; max-width: 640px;}
190
- .gr-button {background: #7fbdf6; color: #fff; border-radius: 8px;}
191
- #prompt-box textarea {font-size: 1.1rem; height: 9rem !important; background: #fff; color: #222;}
 
192
  .boost-btn {background: #ff7eb6; margin-top: 5px;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  """
194
 
195
  author_note = (
@@ -214,14 +274,14 @@ with gr.Blocks(css=css, theme=gr.themes.Soft()) as demo:
214
  f"""
215
  ## 🖌️ NSFW TEST Playground
216
  {author_note}
217
- """
218
  )
219
 
220
  # Create state variables to store the current image
221
  current_image = gr.State(None)
222
  current_seed = gr.State(0)
223
 
224
- with gr.Column(elem_id="col-container"):
225
  # Add keyword input and boost button
226
  with gr.Row():
227
  keyword_input = gr.Text(
@@ -231,6 +291,7 @@ with gr.Blocks(css=css, theme=gr.themes.Soft()) as demo:
231
  placeholder="Enter a keyword or theme to generate an optimal prompt"
232
  )
233
  boost_button = gr.Button("BOOST", elem_classes=["boost-btn"])
 
234
 
235
  with gr.Row():
236
  prompt = gr.Text(
@@ -243,46 +304,9 @@ with gr.Blocks(css=css, theme=gr.themes.Soft()) as demo:
243
  run_button = gr.Button("Generate", scale=0)
244
 
245
  # Image output area
246
- result = gr.Image(label="Generated Image")
247
-
248
- examples = gr.Examples(
249
- examples=[
250
- ["Her skirt rose a little higher with each gentle push, a soft blush of blush spreading across her cheeks as she felt the satisfying warmth of his breath on her cheek."],
251
- ["a girl in a school uniform having her skirt pulled up by a boy, and then being fucked"],
252
- ["Moody mature anime scene of two lovers fuck under neon rain, sensual atmosphere"],
253
- ["Moody mature anime scene of two lovers kissing under neon rain, sensual atmosphere"],
254
- ["The girl sits on the boy's lap by the window, his hands resting on her waist. She is unbuttoning his shirt, her expression focused and intense."],
255
- ["A girl with long, black hair is sleeping on her desk in the classroom. Her skirt has ridden up, revealing her thighs, and a trail of drool escapes her slightly parted lips."],
256
- ["The waves rolled gently, a slow, sweet kiss of the lip, a slow, slow build of anticipation as their toes bumped gently – a slow, sweet kiss of the lip, a promise of more to come."],
257
- ["Her elegant silk gown swayed gracefully as she approached him, the delicate fabric brushing against her legs. A warm blush spread across her cheeks as she felt his breath on her face."],
258
- ["Her white blouse and light cotton skirt rose a little higher with each gentle push, a soft blush spreading across her cheeks as she felt the satisfying warmth of his breath on her cheek."],
259
- ["A woman in a business suit having her skirt lifted by a man, and then being sexually assaulted."],
260
- ["The older woman sits on the man's bra the fireplace, his hands resting on her hips. She is unbuttoning his vest, her expression focused and intense. fuck"],
261
- ["The older woman sits on the man's lap by the fireplace, his hands resting on her hips. She is unbuttoning his vest, her expression focused and intense. He takes control of the situation as she finishes unbuttoning his shirt, pushing her onto her back and begins to have sex with her."],
262
- ["There is a woman with long black hair. Her face features alluring eyes and full lips, with a slender figure adorned in black lace lingerie. She lies on the bed, loosening her lingerie strap with one hand while seductively glancing downward."],
263
- ["In a dimly lit room, the same woman teases with her dark, flowing hair, now covering her voluptuous breasts, while a black garter belt accentuates her thighs. She sits on the sofa, leaning back, lifting one leg to expose her most private areas through the sheer lingerie."],
264
- ["A woman with glasses, lying on the bed in just her bra, spreads her legs wide, revealing all! She wears a sultry expression, gazing directly at the viewer with her brown eyes, her short black hair cascading over the pillow. Her slim figure, accentuated by the lacy lingerie, exudes a seductive aura."],
265
- ["woman now fuck flows down to reveal her supple body, ample breasts, and smooth thighs. She stands by the window, gazing at the city bathed in the glow of sunset, gently caressing her neck."],
266
- ["A soft focus on the girl's face, eyes closed, biting her lip, as her roommate performs oral pleasure, the experienced woman's hair cascading between her thighs."],
267
- ["A woman in a blue hanbok sits on a wooden floor, her legs folded beneath her, gazing out of a window, the sunlight highlighting the graceful lines of her clothing."],
268
- ["The couple, immersed in a wooden outdoor bath, share an intimate moment, her wet kimono clinging to her curves, his hands exploring her body beneath the water's surface."],
269
- ["A steamy shower scene, the twins embrace under the warm water, their soapy hands gliding over each other's curves, their passion intensifying as they explore uncharted territories."],
270
- ["The teacher, with a firm grip, pins the student against the blackboard, her skirt hiked up, exposing her delicate lace panties. Their heavy breathing echoes in the quiet room as they share an intense, intimate moment."],
271
- ["After hours, the girl sits on top of the teacher's lap, riding him on the classroom floor, her hair cascading over her face as she moves with increasing intensity, their bodies glistening with sweat."],
272
- ["In the dimly lit dorm room, the roommates lay entangled in a passionate embrace, their naked bodies glistening with sweat, as the experienced woman teaches her lover the art of kissing and touching."],
273
- ["The once-innocent student, now confident, takes charge, straddling her lover on the couch, their bare skin illuminated by the warm glow of the sunset through the window."],
274
- ["A close-up of the secretary's hand unzipping her boss's dress shirt, her fingers gently caressing his chest, their eyes locked in a heated embrace in the supply closet."],
275
- ["The secretary, in a tight pencil skirt and silk blouse, leans back on the boss's desk, her legs wrapped around his waist, her blouse unbuttoned, revealing her lace bra, as he passionately kisses her, his hands exploring her body."],
276
- ["On the living room couch, one twin sits astride her sister's lap, their lips locked in a passionate kiss, their hands tangled in each other's hair, unraveling a new level of intimacy."],
277
- ["In a dimly lit chamber, the dominant woman, dressed in a leather corset and thigh-high boots, stands tall, her hand gripping her submissive partner's hair, his eyes closed in submission as she instructs him to please her."],
278
- ["The dominant, in a sheer lace bodysuit, sits on a throne-like chair, her legs spread, as the submissive, on his knees, worships her with his tongue, his hands bound behind his back."],
279
- ["A traditional Japanese onsen, with steam rising, a young woman in a colorful kimono kneels on a tatami mat, her back to the viewer, as her male partner, also in a kimono, gently unties her obi, revealing her bare back."],
280
- ["In a serene outdoor setting, the woman, in a vibrant summer kimono, sits on a bench, her legs slightly spread, her partner kneeling before her, his hands gently caressing her exposed thigh."],
281
- ],
282
- inputs=[prompt],
283
- )
284
 
285
- with gr.Accordion("Advanced Settings", open=False):
286
  negative_prompt = gr.Text(
287
  label="Negative prompt",
288
  max_lines=1,
@@ -311,6 +335,13 @@ with gr.Blocks(css=css, theme=gr.themes.Soft()) as demo:
311
  inputs=[keyword_input],
312
  outputs=[prompt]
313
  )
 
 
 
 
 
 
 
314
 
315
  # Connect image generation button
316
  run_button.click(
 
70
  print("[WARN] Translation failed at runtime →", e)
71
  return text
72
 
73
+ # ------------------------------------------------------------
74
+ # EXAMPLES (Hidden from UI but used for RANDOM button)
75
+ # ------------------------------------------------------------
76
+ prompt_examples = [
77
+ "Her skirt rose a little higher with each gentle push, a soft blush of blush spreading across her cheeks as she felt the satisfying warmth of his breath on her cheek.",
78
+ "a girl in a school uniform having her skirt pulled up by a boy, and then being fucked",
79
+ "Moody mature anime scene of two lovers fuck under neon rain, sensual atmosphere",
80
+ "Moody mature anime scene of two lovers kissing under neon rain, sensual atmosphere",
81
+ "The girl sits on the boy's lap by the window, his hands resting on her waist. She is unbuttoning his shirt, her expression focused and intense.",
82
+ "A girl with long, black hair is sleeping on her desk in the classroom. Her skirt has ridden up, revealing her thighs, and a trail of drool escapes her slightly parted lips.",
83
+ "The waves rolled gently, a slow, sweet kiss of the lip, a slow, slow build of anticipation as their toes bumped gently – a slow, sweet kiss of the lip, a promise of more to come.",
84
+ "Her elegant silk gown swayed gracefully as she approached him, the delicate fabric brushing against her legs. A warm blush spread across her cheeks as she felt his breath on her face.",
85
+ "Her white blouse and light cotton skirt rose a little higher with each gentle push, a soft blush spreading across her cheeks as she felt the satisfying warmth of his breath on her cheek.",
86
+ "A woman in a business suit having her skirt lifted by a man, and then being sexually assaulted.",
87
+ "The older woman sits on the man's lap by the fireplace, his hands resting on her hips. She is unbuttoning his vest, her expression focused and intense. He takes control of the situation as she finishes unbuttoning his shirt, pushing her onto her back and begins to have sex with her.",
88
+ "There is a woman with long black hair. Her face features alluring eyes and full lips, with a slender figure adorned in black lace lingerie. She lies on the bed, loosening her lingerie strap with one hand while seductively glancing downward.",
89
+ "In a dimly lit room, the same woman teases with her dark, flowing hair, now covering her voluptuous breasts, while a black garter belt accentuates her thighs. She sits on the sofa, leaning back, lifting one leg to expose her most private areas through the sheer lingerie.",
90
+ "A woman with glasses, lying on the bed in just her bra, spreads her legs wide, revealing all! She wears a sultry expression, gazing directly at the viewer with her brown eyes, her short black hair cascading over the pillow. Her slim figure, accentuated by the lacy lingerie, exudes a seductive aura.",
91
+ "A soft focus on the girl's face, eyes closed, biting her lip, as her roommate performs oral pleasure, the experienced woman's hair cascading between her thighs.",
92
+ "A woman in a blue hanbok sits on a wooden floor, her legs folded beneath her, gazing out of a window, the sunlight highlighting the graceful lines of her clothing.",
93
+ "The couple, immersed in a wooden outdoor bath, share an intimate moment, her wet kimono clinging to her curves, his hands exploring her body beneath the water's surface.",
94
+ "A steamy shower scene, the twins embrace under the warm water, their soapy hands gliding over each other's curves, their passion intensifying as they explore uncharted territories.",
95
+ "The teacher, with a firm grip, pins the student against the blackboard, her skirt hiked up, exposing her delicate lace panties. Their heavy breathing echoes in the quiet room as they share an intense, intimate moment.",
96
+ "After hours, the girl sits on top of the teacher's lap, riding him on the classroom floor, her hair cascading over her face as she moves with increasing intensity, their bodies glistening with sweat.",
97
+ "In the dimly lit dorm room, the roommates lay entangled in a passionate embrace, their naked bodies glistening with sweat, as the experienced woman teaches her lover the art of kissing and touching.",
98
+ "The once-innocent student, now confident, takes charge, straddling her lover on the couch, their bare skin illuminated by the warm glow of the sunset through the window.",
99
+ "A close-up of the secretary's hand unzipping her boss's dress shirt, her fingers gently caressing his chest, their eyes locked in a heated embrace in the supply closet.",
100
+ "The secretary, in a tight pencil skirt and silk blouse, leans back on the boss's desk, her legs wrapped around his waist, her blouse unbuttoned, revealing her lace bra, as he passionately kisses her, his hands exploring her body.",
101
+ "On the living room couch, one twin sits astride her sister's lap, their lips locked in a passionate kiss, their hands tangled in each other's hair, unraveling a new level of intimacy.",
102
+ "In a dimly lit chamber, the dominant woman, dressed in a leather corset and thigh-high boots, stands tall, her hand gripping her submissive partner's hair, his eyes closed in submission as she instructs him to please her.",
103
+ "The dominant, in a sheer lace bodysuit, sits on a throne-like chair, her legs spread, as the submissive, on his knees, worships her with his tongue, his hands bound behind his back.",
104
+ "A traditional Japanese onsen, with steam rising, a young woman in a colorful kimono kneels on a tatami mat, her back to the viewer, as her male partner, also in a kimono, gently unties her obi, revealing her bare back.",
105
+ "In a serene outdoor setting, the woman, in a vibrant summer kimono, sits on a bench, her legs slightly spread, her partner kneeling before her, his hands gently caressing her exposed thigh.",
106
+ ]
107
+
108
  # ------------------------------------------------------------
109
  # LLM PROMPT GENERATOR
110
  # ------------------------------------------------------------
 
216
  print(f"[ERROR] Diffusion failed → {e}")
217
  return Image.new("RGB", (width, height), color=(0, 0, 0)), seed
218
 
219
+ # Function to select a random example prompt
220
+ def get_random_prompt():
221
+ return random.choice(prompt_examples)
222
+
223
  # ------------------------------------------------------------
224
+ # UI LAYOUT + THEME (Enhanced Visual Design)
225
  # ------------------------------------------------------------
226
  css = """
227
+ body {background: linear-gradient(135deg, #f2e6ff 0%, #e6f0ff 100%); color: #222; font-family: 'Noto Sans', sans-serif;}
228
+ #col-container {margin: 0 auto; max-width: 768px; padding: 15px; background: rgba(255, 255, 255, 0.8); border-radius: 15px; box-shadow: 0 8px 32px rgba(31, 38, 135, 0.2);}
229
+ .gr-button {background: #7fbdf6; color: #fff; border-radius: 8px; transition: all 0.3s ease; font-weight: bold;}
230
+ .gr-button:hover {background: #5a9ae6; transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.1);}
231
+ #prompt-box textarea {font-size: 1.1rem; height: 9rem !important; background: #fff; color: #222; border-radius: 10px; border: 1px solid #d1c1e0;}
232
  .boost-btn {background: #ff7eb6; margin-top: 5px;}
233
+ .boost-btn:hover {background: #ff5aa5;}
234
+ .random-btn {background: #9966ff; margin-top: 5px;}
235
+ .random-btn:hover {background: #8040ff;}
236
+ .container {animation: fadeIn 0.5s ease-in-out;}
237
+ .title {color: #6600cc; text-shadow: 1px 1px 2px rgba(0,0,0,0.1);}
238
+ .gr-form {border: none !important; background: transparent !important;}
239
+ .gr-input {border-radius: 8px !important;}
240
+ .gr-slider {height: 12px !important;}
241
+ .gr-slider .handle {height: 20px !important; width: 20px !important;}
242
+ .panel {border-radius: 12px; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.1);}
243
+ .gr-image {border-radius: 12px; overflow: hidden; transition: all 0.3s ease;}
244
+ .gr-image:hover {transform: scale(1.02); box-shadow: 0 8px 25px rgba(0,0,0,0.15);}
245
+
246
+ @keyframes fadeIn {
247
+ from {opacity: 0; transform: translateY(20px);}
248
+ to {opacity: 1; transform: translateY(0);}
249
+ }
250
+
251
+ .gr-accordion {border-radius: 10px; overflow: hidden; transition: all 0.3s ease;}
252
+ .gr-accordion:hover {box-shadow: 0 5px 15px rgba(0,0,0,0.1);}
253
  """
254
 
255
  author_note = (
 
274
  f"""
275
  ## 🖌️ NSFW TEST Playground
276
  {author_note}
277
+ """, elem_classes=["title"]
278
  )
279
 
280
  # Create state variables to store the current image
281
  current_image = gr.State(None)
282
  current_seed = gr.State(0)
283
 
284
+ with gr.Column(elem_id="col-container", elem_classes=["container", "panel"]):
285
  # Add keyword input and boost button
286
  with gr.Row():
287
  keyword_input = gr.Text(
 
291
  placeholder="Enter a keyword or theme to generate an optimal prompt"
292
  )
293
  boost_button = gr.Button("BOOST", elem_classes=["boost-btn"])
294
+ random_button = gr.Button("RANDOM", elem_classes=["random-btn"])
295
 
296
  with gr.Row():
297
  prompt = gr.Text(
 
304
  run_button = gr.Button("Generate", scale=0)
305
 
306
  # Image output area
307
+ result = gr.Image(label="Generated Image", elem_classes=["gr-image"])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
 
309
+ with gr.Accordion("Advanced Settings", open=False, elem_classes=["gr-accordion"]):
310
  negative_prompt = gr.Text(
311
  label="Negative prompt",
312
  max_lines=1,
 
335
  inputs=[keyword_input],
336
  outputs=[prompt]
337
  )
338
+
339
+ # Connect random button to insert random example
340
+ random_button.click(
341
+ fn=get_random_prompt,
342
+ inputs=[],
343
+ outputs=[prompt]
344
+ )
345
 
346
  # Connect image generation button
347
  run_button.click(