ginipick commited on
Commit
227d8c5
Β·
verified Β·
1 Parent(s): d4e050d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +44 -10
app.py CHANGED
@@ -170,6 +170,7 @@ def is_all_english(text: str) -> bool:
170
  and a few basic punctuation characters. If so, return True.
171
  Otherwise, False (includes Korean or other characters).
172
  """
 
173
  return bool(re.match(r'^[a-zA-Z0-9\s\.,!\?\']*$', text))
174
 
175
  def maybe_use_random_or_original(final_text: str) -> str:
@@ -318,39 +319,72 @@ def run_process(
318
  with gr.Blocks(title="Eevery Text Imaginator: FLUX") as demo:
319
  gr.Markdown(
320
  """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
321
  <h2 style="text-align:center; margin-bottom: 15px;">
322
  <strong>Eevery Text Imaginator: FLUX</strong>
323
  </h2>
324
 
325
  <p style="text-align:center;">
326
- This tool generates two final images from a prompt
327
  containing placeholders <code>&lt;text1&gt;</code>, <code>&lt;text2&gt;</code>, <code>&lt;text3&gt;</code>.
328
- If your chosen text is purely English, it will appear directly;
329
- otherwise it becomes random letters in the initial phase.
330
  </p>
331
 
332
  <hr style="margin: 15px 0;">
333
  """
334
  )
335
 
336
- # 5 example prompts (focusing on <text1>, <text2>)
337
  examples = [
338
  [
339
  "Futuristic neon sign with <text1>, plus near the bottom",
340
  "OPEN", "", ""
341
- ],
342
  [
343
  "On a grand stage, <text1> in big letters and on the left side",
344
  "ν™˜μ˜ν•©λ‹ˆλ‹€.", "", ""
345
  ],
346
-
347
  [
348
  "A classical poster reading <text1> in bold, as a subtitle",
349
  "错觉", "", ""
350
  ],
351
  [
352
  "In a cartoon style, a speech bubble with <text1> and another text ",
353
- "μ•ˆ", "", ""
354
  ],
355
  [
356
  "Large billboard featuring <text1>",
@@ -359,13 +393,12 @@ with gr.Blocks(title="Eevery Text Imaginator: FLUX") as demo:
359
  [
360
  "μ¬κΈ€λΌμŠ€ μ°©μš©ν•œ 흰색 κ³ μ–‘μ΄μ˜ λ°°λ„ˆ <text1>",
361
  "μ•ˆλ…•", "", ""
362
- ],
363
  ]
364
 
365
  with gr.Row():
366
  with gr.Column():
367
- # Instead of gr.Box(), we can just group them or leave them as is
368
- with gr.Group():
369
  prompt_input = gr.Textbox(
370
  lines=3,
371
  label="Prompt (Korean or English)",
@@ -393,6 +426,7 @@ with gr.Blocks(title="Eevery Text Imaginator: FLUX") as demo:
393
 
394
  run_btn = gr.Button("Generate 2 Final Images", variant="primary")
395
 
 
396
  gr.Examples(
397
  examples=examples,
398
  inputs=[prompt_input, final_text1, final_text2, final_text3],
 
170
  and a few basic punctuation characters. If so, return True.
171
  Otherwise, False (includes Korean or other characters).
172
  """
173
+ import re
174
  return bool(re.match(r'^[a-zA-Z0-9\s\.,!\?\']*$', text))
175
 
176
  def maybe_use_random_or_original(final_text: str) -> str:
 
319
  with gr.Blocks(title="Eevery Text Imaginator: FLUX") as demo:
320
  gr.Markdown(
321
  """
322
+ <style>
323
+ /* Set a gradient background for the entire page */
324
+ body {
325
+ background: linear-gradient(to right, #ffecd2, #fcb69f);
326
+ margin: 0;
327
+ padding: 0;
328
+ }
329
+ .gradio-container {
330
+ font-family: "Trebuchet MS", sans-serif;
331
+ color: #333;
332
+ max-width: 1200px;
333
+ margin: 0 auto;
334
+ padding: 20px;
335
+ }
336
+ h2 {
337
+ color: #4CAF50;
338
+ }
339
+ p, label {
340
+ color: #5c6bc0;
341
+ }
342
+ .gr-button {
343
+ background-color: #fff176 !important;
344
+ color: #000 !important;
345
+ border: none !important;
346
+ margin-top: 10px !important;
347
+ }
348
+ .gr-button:hover {
349
+ background-color: #ffe100 !important;
350
+ }
351
+ .gr-examples > .label {
352
+ color: #d500f9;
353
+ }
354
+ </style>
355
+
356
  <h2 style="text-align:center; margin-bottom: 15px;">
357
  <strong>Eevery Text Imaginator: FLUX</strong>
358
  </h2>
359
 
360
  <p style="text-align:center;">
361
+ This tool generates <b>two final images</b> from a prompt
362
  containing placeholders <code>&lt;text1&gt;</code>, <code>&lt;text2&gt;</code>, <code>&lt;text3&gt;</code>.
363
+ <br>If your chosen text is purely English, it will appear directly;
364
+ otherwise it becomes <i>random letters</i> in the initial phase.
365
  </p>
366
 
367
  <hr style="margin: 15px 0;">
368
  """
369
  )
370
 
371
+ # 6 example prompts (slightly more colorful list)
372
  examples = [
373
  [
374
  "Futuristic neon sign with <text1>, plus near the bottom",
375
  "OPEN", "", ""
376
+ ],
377
  [
378
  "On a grand stage, <text1> in big letters and on the left side",
379
  "ν™˜μ˜ν•©λ‹ˆλ‹€.", "", ""
380
  ],
 
381
  [
382
  "A classical poster reading <text1> in bold, as a subtitle",
383
  "错觉", "", ""
384
  ],
385
  [
386
  "In a cartoon style, a speech bubble with <text1> and another text ",
387
+ "μ•ˆλ…•", "", ""
388
  ],
389
  [
390
  "Large billboard featuring <text1>",
 
393
  [
394
  "μ¬κΈ€λΌμŠ€ μ°©μš©ν•œ 흰색 κ³ μ–‘μ΄μ˜ λ°°λ„ˆ <text1>",
395
  "μ•ˆλ…•", "", ""
396
+ ],
397
  ]
398
 
399
  with gr.Row():
400
  with gr.Column():
401
+ with gr.Group():
 
402
  prompt_input = gr.Textbox(
403
  lines=3,
404
  label="Prompt (Korean or English)",
 
426
 
427
  run_btn = gr.Button("Generate 2 Final Images", variant="primary")
428
 
429
+ # Show the examples
430
  gr.Examples(
431
  examples=examples,
432
  inputs=[prompt_input, final_text1, final_text2, final_text3],