Spaces:
Running
Running
gokaygokay
commited on
Commit
•
9969ce7
1
Parent(s):
14c21df
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
import random
|
3 |
import json
|
@@ -333,7 +381,6 @@ class HuggingFaceInferenceNode:
|
|
333 |
default_simple_prompt = """Create a brief, straightforward caption for this description, suitable for a text-to-image AI system. Focus on the main elements, key characters, and overall scene without elaborate details. Provide a clear and concise description in one or two sentences."""
|
334 |
|
335 |
poster_prompt = """Analyze the provided description and extract key information to create a movie poster style description. Format the output as follows:
|
336 |
-
|
337 |
Title: A catchy, intriguing title that captures the essence of the scene, place the title in "".
|
338 |
Main character: Give a description of the main character.
|
339 |
Background: Describe the background in detail.
|
@@ -378,7 +425,6 @@ title = """<h1 align="center">FLUX Prompt Generator</h1>
|
|
378 |
<p><center>
|
379 |
<a href="https://github.com/dagthomas/comfyui_dagthomas" target="_blank">[comfyui_dagthomas]</a>
|
380 |
<a href="https://github.com/dagthomas" target="_blank">[dagthomas Github]</a>
|
381 |
-
|
382 |
<p align="center">Create long prompts from images or simple words. Enhance your short prompts with prompt enhancer.</p>
|
383 |
</center></p>
|
384 |
"""
|
@@ -394,7 +440,7 @@ def create_interface():
|
|
394 |
with gr.Row():
|
395 |
with gr.Column(scale=2):
|
396 |
with gr.Accordion("Basic Settings"):
|
397 |
-
seed = gr.Number(label="Seed", value
|
398 |
custom = gr.Textbox(label="Custom Input Prompt (optional)")
|
399 |
subject = gr.Textbox(label="Subject (optional)")
|
400 |
|
@@ -464,22 +510,14 @@ def create_interface():
|
|
464 |
outputs=[caption_output]
|
465 |
)
|
466 |
|
467 |
-
def generate_prompt_with_random_seed(*args):
|
468 |
-
if args[0] == -1: # If seed is -1, use a random seed
|
469 |
-
random_seed = random.randint(0, 2**32 - 1)
|
470 |
-
args = list(args)
|
471 |
-
args[0] = random_seed
|
472 |
-
return prompt_generator.generate_prompt(*args)
|
473 |
-
|
474 |
generate_button.click(
|
475 |
-
|
476 |
inputs=[seed, custom, subject, artform, photo_type, body_types, default_tags, roles, hairstyles,
|
477 |
additional_details, photography_styles, device, photographer, artist, digital_artform,
|
478 |
place, lighting, clothing, composition, pose, background],
|
479 |
outputs=[output, gr.Number(visible=False), t5xxl_output, clip_l_output, clip_g_output]
|
480 |
)
|
481 |
|
482 |
-
|
483 |
add_caption_button.click(
|
484 |
prompt_generator.add_caption_to_prompt,
|
485 |
inputs=[output, caption_output],
|
|
|
1 |
+
Hugging Face's logo
|
2 |
+
Hugging Face
|
3 |
+
Search models, datasets, users...
|
4 |
+
Models
|
5 |
+
Datasets
|
6 |
+
Spaces
|
7 |
+
Posts
|
8 |
+
Docs
|
9 |
+
Solutions
|
10 |
+
Pricing
|
11 |
+
|
12 |
+
|
13 |
+
|
14 |
+
Spaces:
|
15 |
+
|
16 |
+
gokaygokay
|
17 |
+
/
|
18 |
+
FLUX-Prompt-Generator
|
19 |
+
|
20 |
+
|
21 |
+
like
|
22 |
+
10
|
23 |
+
|
24 |
+
Logs
|
25 |
+
App
|
26 |
+
Files
|
27 |
+
Community
|
28 |
+
Settings
|
29 |
+
FLUX-Prompt-Generator
|
30 |
+
/
|
31 |
+
app.py
|
32 |
+
|
33 |
+
gokaygokay's picture
|
34 |
+
gokaygokay
|
35 |
+
Update app.py
|
36 |
+
b65ff3c
|
37 |
+
verified
|
38 |
+
less than a minute ago
|
39 |
+
raw
|
40 |
+
|
41 |
+
Copy download link
|
42 |
+
history
|
43 |
+
blame
|
44 |
+
edit
|
45 |
+
delete
|
46 |
+
No virus
|
47 |
+
|
48 |
+
26.2 kB
|
49 |
import gradio as gr
|
50 |
import random
|
51 |
import json
|
|
|
381 |
default_simple_prompt = """Create a brief, straightforward caption for this description, suitable for a text-to-image AI system. Focus on the main elements, key characters, and overall scene without elaborate details. Provide a clear and concise description in one or two sentences."""
|
382 |
|
383 |
poster_prompt = """Analyze the provided description and extract key information to create a movie poster style description. Format the output as follows:
|
|
|
384 |
Title: A catchy, intriguing title that captures the essence of the scene, place the title in "".
|
385 |
Main character: Give a description of the main character.
|
386 |
Background: Describe the background in detail.
|
|
|
425 |
<p><center>
|
426 |
<a href="https://github.com/dagthomas/comfyui_dagthomas" target="_blank">[comfyui_dagthomas]</a>
|
427 |
<a href="https://github.com/dagthomas" target="_blank">[dagthomas Github]</a>
|
|
|
428 |
<p align="center">Create long prompts from images or simple words. Enhance your short prompts with prompt enhancer.</p>
|
429 |
</center></p>
|
430 |
"""
|
|
|
440 |
with gr.Row():
|
441 |
with gr.Column(scale=2):
|
442 |
with gr.Accordion("Basic Settings"):
|
443 |
+
seed = gr.Number(label="Seed", value=0)
|
444 |
custom = gr.Textbox(label="Custom Input Prompt (optional)")
|
445 |
subject = gr.Textbox(label="Subject (optional)")
|
446 |
|
|
|
510 |
outputs=[caption_output]
|
511 |
)
|
512 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
513 |
generate_button.click(
|
514 |
+
prompt_generator.generate_prompt,
|
515 |
inputs=[seed, custom, subject, artform, photo_type, body_types, default_tags, roles, hairstyles,
|
516 |
additional_details, photography_styles, device, photographer, artist, digital_artform,
|
517 |
place, lighting, clothing, composition, pose, background],
|
518 |
outputs=[output, gr.Number(visible=False), t5xxl_output, clip_l_output, clip_g_output]
|
519 |
)
|
520 |
|
|
|
521 |
add_caption_button.click(
|
522 |
prompt_generator.add_caption_to_prompt,
|
523 |
inputs=[output, caption_output],
|