Spaces:
Runtime error
Runtime error
Commit
·
45523be
1
Parent(s):
5edca44
files
Browse files
app.py
CHANGED
|
@@ -343,7 +343,6 @@ def create_interface():
|
|
| 343 |
gr.Markdown("# AI Prompt Generator and Text Generator")
|
| 344 |
|
| 345 |
with gr.Row():
|
| 346 |
-
|
| 347 |
with gr.Column():
|
| 348 |
seed = gr.Number(label="Seed", value=0)
|
| 349 |
custom = gr.Textbox(label="Custom")
|
|
@@ -352,14 +351,13 @@ def create_interface():
|
|
| 352 |
photo_type = gr.Dropdown(["disabled", "random"] + PHOTO_TYPE, label="Photo Type", value="random")
|
| 353 |
body_types = gr.Dropdown(["disabled", "random"] + BODY_TYPES, label="Body Types", value="random")
|
| 354 |
default_tags = gr.Dropdown(["disabled", "random"] + DEFAULT_TAGS, label="Default Tags", value="random")
|
| 355 |
-
with gr.Column():
|
| 356 |
roles = gr.Dropdown(["disabled", "random"] + ROLES, label="Roles", value="random")
|
| 357 |
hairstyles = gr.Dropdown(["disabled", "random"] + HAIRSTYLES, label="Hairstyles", value="random")
|
| 358 |
additional_details = gr.Dropdown(["disabled", "random"] + ADDITIONAL_DETAILS, label="Additional Details", value="random")
|
| 359 |
photography_styles = gr.Dropdown(["disabled", "random"] + PHOTOGRAPHY_STYLES, label="Photography Styles", value="random")
|
|
|
|
| 360 |
device = gr.Dropdown(["disabled", "random"] + DEVICE, label="Device", value="random")
|
| 361 |
photographer = gr.Dropdown(["disabled", "random"] + PHOTOGRAPHER, label="Photographer", value="random")
|
| 362 |
-
with gr.Column():
|
| 363 |
artist = gr.Dropdown(["disabled", "random"] + ARTIST, label="Artist", value="random")
|
| 364 |
digital_artform = gr.Dropdown(["disabled", "random"] + DIGITAL_ARTFORM, label="Digital Artform", value="random")
|
| 365 |
place = gr.Dropdown(["disabled", "random"] + PLACE, label="Place", value="random")
|
|
@@ -368,17 +366,16 @@ def create_interface():
|
|
| 368 |
composition = gr.Dropdown(["disabled", "random"] + COMPOSITION, label="Composition", value="random")
|
| 369 |
pose = gr.Dropdown(["disabled", "random"] + POSE, label="Pose", value="random")
|
| 370 |
background = gr.Dropdown(["disabled", "random"] + BACKGROUND, label="Background", value="random")
|
| 371 |
-
|
| 372 |
generate_button = gr.Button("Generate Prompt")
|
| 373 |
-
output = gr.Textbox(label="Generated Prompt")
|
| 374 |
-
t5xxl_output = gr.Textbox(label="T5XXL Output", visible=
|
| 375 |
-
clip_l_output = gr.Textbox(label="CLIP L Output", visible=
|
| 376 |
-
clip_g_output = gr.Textbox(label="CLIP G Output", visible=
|
| 377 |
|
| 378 |
with gr.Column():
|
| 379 |
# HuggingFace Inference Text Generator inputs
|
| 380 |
model = gr.Dropdown(["Mixtral", "Mistral", "Llama 3", "Mistral-Nemo"], label="Model", value="Mixtral")
|
| 381 |
-
input_text = gr.Textbox(label="Input Text", lines=5)
|
| 382 |
happy_talk = gr.Checkbox(label="Happy Talk", value=True)
|
| 383 |
compress = gr.Checkbox(label="Compress", value=False)
|
| 384 |
compression_level = gr.Radio(["soft", "medium", "hard"], label="Compression Level", value="medium")
|
|
@@ -394,15 +391,11 @@ def create_interface():
|
|
| 394 |
additional_details, photography_styles, device, photographer, artist, digital_artform,
|
| 395 |
place, lighting, clothing, composition, pose, background],
|
| 396 |
outputs=[output, gr.Number(visible=False), t5xxl_output, clip_l_output, clip_g_output]
|
| 397 |
-
).then(
|
| 398 |
-
lambda x: x,
|
| 399 |
-
inputs=[output],
|
| 400 |
-
outputs=[input_text]
|
| 401 |
)
|
| 402 |
|
| 403 |
generate_text_button.click(
|
| 404 |
huggingface_node.generate,
|
| 405 |
-
inputs=[model,
|
| 406 |
outputs=text_output
|
| 407 |
)
|
| 408 |
|
|
|
|
| 343 |
gr.Markdown("# AI Prompt Generator and Text Generator")
|
| 344 |
|
| 345 |
with gr.Row():
|
|
|
|
| 346 |
with gr.Column():
|
| 347 |
seed = gr.Number(label="Seed", value=0)
|
| 348 |
custom = gr.Textbox(label="Custom")
|
|
|
|
| 351 |
photo_type = gr.Dropdown(["disabled", "random"] + PHOTO_TYPE, label="Photo Type", value="random")
|
| 352 |
body_types = gr.Dropdown(["disabled", "random"] + BODY_TYPES, label="Body Types", value="random")
|
| 353 |
default_tags = gr.Dropdown(["disabled", "random"] + DEFAULT_TAGS, label="Default Tags", value="random")
|
|
|
|
| 354 |
roles = gr.Dropdown(["disabled", "random"] + ROLES, label="Roles", value="random")
|
| 355 |
hairstyles = gr.Dropdown(["disabled", "random"] + HAIRSTYLES, label="Hairstyles", value="random")
|
| 356 |
additional_details = gr.Dropdown(["disabled", "random"] + ADDITIONAL_DETAILS, label="Additional Details", value="random")
|
| 357 |
photography_styles = gr.Dropdown(["disabled", "random"] + PHOTOGRAPHY_STYLES, label="Photography Styles", value="random")
|
| 358 |
+
with gr.Column():
|
| 359 |
device = gr.Dropdown(["disabled", "random"] + DEVICE, label="Device", value="random")
|
| 360 |
photographer = gr.Dropdown(["disabled", "random"] + PHOTOGRAPHER, label="Photographer", value="random")
|
|
|
|
| 361 |
artist = gr.Dropdown(["disabled", "random"] + ARTIST, label="Artist", value="random")
|
| 362 |
digital_artform = gr.Dropdown(["disabled", "random"] + DIGITAL_ARTFORM, label="Digital Artform", value="random")
|
| 363 |
place = gr.Dropdown(["disabled", "random"] + PLACE, label="Place", value="random")
|
|
|
|
| 366 |
composition = gr.Dropdown(["disabled", "random"] + COMPOSITION, label="Composition", value="random")
|
| 367 |
pose = gr.Dropdown(["disabled", "random"] + POSE, label="Pose", value="random")
|
| 368 |
background = gr.Dropdown(["disabled", "random"] + BACKGROUND, label="Background", value="random")
|
| 369 |
+
with gr.Column():
|
| 370 |
generate_button = gr.Button("Generate Prompt")
|
| 371 |
+
output = gr.Textbox(label="Generated Prompt / Input Text", lines=5)
|
| 372 |
+
t5xxl_output = gr.Textbox(label="T5XXL Output", visible=True)
|
| 373 |
+
clip_l_output = gr.Textbox(label="CLIP L Output", visible=True)
|
| 374 |
+
clip_g_output = gr.Textbox(label="CLIP G Output", visible=True)
|
| 375 |
|
| 376 |
with gr.Column():
|
| 377 |
# HuggingFace Inference Text Generator inputs
|
| 378 |
model = gr.Dropdown(["Mixtral", "Mistral", "Llama 3", "Mistral-Nemo"], label="Model", value="Mixtral")
|
|
|
|
| 379 |
happy_talk = gr.Checkbox(label="Happy Talk", value=True)
|
| 380 |
compress = gr.Checkbox(label="Compress", value=False)
|
| 381 |
compression_level = gr.Radio(["soft", "medium", "hard"], label="Compression Level", value="medium")
|
|
|
|
| 391 |
additional_details, photography_styles, device, photographer, artist, digital_artform,
|
| 392 |
place, lighting, clothing, composition, pose, background],
|
| 393 |
outputs=[output, gr.Number(visible=False), t5xxl_output, clip_l_output, clip_g_output]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 394 |
)
|
| 395 |
|
| 396 |
generate_text_button.click(
|
| 397 |
huggingface_node.generate,
|
| 398 |
+
inputs=[model, output, happy_talk, compress, compression_level, poster, custom_base_prompt],
|
| 399 |
outputs=text_output
|
| 400 |
)
|
| 401 |
|