Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -297,7 +297,7 @@ class PromptGenerator:
|
|
| 297 |
|
| 298 |
def add_caption_to_prompt(self, prompt, caption):
|
| 299 |
if caption:
|
| 300 |
-
return f"{prompt} {caption}"
|
| 301 |
return prompt
|
| 302 |
|
| 303 |
class HuggingFaceInferenceNode:
|
|
@@ -378,55 +378,63 @@ def create_interface():
|
|
| 378 |
prompt_generator = PromptGenerator()
|
| 379 |
huggingface_node = HuggingFaceInferenceNode()
|
| 380 |
|
| 381 |
-
with gr.Blocks() as demo:
|
| 382 |
gr.Markdown("# AI Prompt Generator and Text Generator")
|
| 383 |
|
| 384 |
with gr.Row():
|
| 385 |
-
with gr.Column():
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 430 |
|
| 431 |
def create_caption(image):
|
| 432 |
if image is not None:
|
|
|
|
| 297 |
|
| 298 |
def add_caption_to_prompt(self, prompt, caption):
|
| 299 |
if caption:
|
| 300 |
+
return f"{prompt}, {caption}"
|
| 301 |
return prompt
|
| 302 |
|
| 303 |
class HuggingFaceInferenceNode:
|
|
|
|
| 378 |
prompt_generator = PromptGenerator()
|
| 379 |
huggingface_node = HuggingFaceInferenceNode()
|
| 380 |
|
| 381 |
+
with gr.Blocks(theme='bethecloud/storj_theme') as demo:
|
| 382 |
gr.Markdown("# AI Prompt Generator and Text Generator")
|
| 383 |
|
| 384 |
with gr.Row():
|
| 385 |
+
with gr.Column(scale=2):
|
| 386 |
+
with gr.Accordion("Basic Settings"):
|
| 387 |
+
seed = gr.Number(label="Seed", value=0)
|
| 388 |
+
custom = gr.Textbox(label="Custom")
|
| 389 |
+
subject = gr.Textbox(label="Subject")
|
| 390 |
+
artform = gr.Dropdown(["disabled", "random"] + ARTFORM, label="Artform", value="photography")
|
| 391 |
+
photo_type = gr.Dropdown(["disabled", "random"] + PHOTO_TYPE, label="Photo Type", value="random")
|
| 392 |
+
|
| 393 |
+
with gr.Accordion("Character Details"):
|
| 394 |
+
body_types = gr.Dropdown(["disabled", "random"] + BODY_TYPES, label="Body Types", value="random")
|
| 395 |
+
default_tags = gr.Dropdown(["disabled", "random"] + DEFAULT_TAGS, label="Default Tags", value="random")
|
| 396 |
+
roles = gr.Dropdown(["disabled", "random"] + ROLES, label="Roles", value="random")
|
| 397 |
+
hairstyles = gr.Dropdown(["disabled", "random"] + HAIRSTYLES, label="Hairstyles", value="random")
|
| 398 |
+
clothing = gr.Dropdown(["disabled", "random"] + CLOTHING, label="Clothing", value="random")
|
| 399 |
+
|
| 400 |
+
with gr.Accordion("Scene Details"):
|
| 401 |
+
place = gr.Dropdown(["disabled", "random"] + PLACE, label="Place", value="random")
|
| 402 |
+
lighting = gr.Dropdown(["disabled", "random"] + LIGHTING, label="Lighting", value="random")
|
| 403 |
+
composition = gr.Dropdown(["disabled", "random"] + COMPOSITION, label="Composition", value="random")
|
| 404 |
+
pose = gr.Dropdown(["disabled", "random"] + POSE, label="Pose", value="random")
|
| 405 |
+
background = gr.Dropdown(["disabled", "random"] + BACKGROUND, label="Background", value="random")
|
| 406 |
+
|
| 407 |
+
with gr.Accordion("Style and Artist"):
|
| 408 |
+
additional_details = gr.Dropdown(["disabled", "random"] + ADDITIONAL_DETAILS, label="Additional Details", value="random")
|
| 409 |
+
photography_styles = gr.Dropdown(["disabled", "random"] + PHOTOGRAPHY_STYLES, label="Photography Styles", value="random")
|
| 410 |
+
device = gr.Dropdown(["disabled", "random"] + DEVICE, label="Device", value="random")
|
| 411 |
+
photographer = gr.Dropdown(["disabled", "random"] + PHOTOGRAPHER, label="Photographer", value="random")
|
| 412 |
+
artist = gr.Dropdown(["disabled", "random"] + ARTIST, label="Artist", value="random")
|
| 413 |
+
digital_artform = gr.Dropdown(["disabled", "random"] + DIGITAL_ARTFORM, label="Digital Artform", value="random")
|
| 414 |
+
|
| 415 |
+
with gr.Column(scale=3):
|
| 416 |
+
with gr.Accordion("Image and Caption", open=True):
|
| 417 |
+
input_image = gr.Image(label="Input Image (optional)")
|
| 418 |
+
caption_output = gr.Textbox(label="Generated Caption", lines=3)
|
| 419 |
+
create_caption_button = gr.Button("Create Caption")
|
| 420 |
+
|
| 421 |
+
with gr.Accordion("Prompt Generation", open=True):
|
| 422 |
+
generate_button = gr.Button("Generate Prompt")
|
| 423 |
+
output = gr.Textbox(label="Generated Prompt / Input Text", lines=5)
|
| 424 |
+
add_caption_button = gr.Button("Add Caption to Prompt")
|
| 425 |
+
t5xxl_output = gr.Textbox(label="T5XXL Output", visible=True)
|
| 426 |
+
clip_l_output = gr.Textbox(label="CLIP L Output", visible=True)
|
| 427 |
+
clip_g_output = gr.Textbox(label="CLIP G Output", visible=True)
|
| 428 |
+
|
| 429 |
+
with gr.Accordion("Text Generation", open=True):
|
| 430 |
+
model = gr.Dropdown(["Mixtral", "Mistral", "Llama 3", "Mistral-Nemo"], label="Model", value="Mixtral")
|
| 431 |
+
happy_talk = gr.Checkbox(label="Happy Talk", value=True)
|
| 432 |
+
compress = gr.Checkbox(label="Compress", value=False)
|
| 433 |
+
compression_level = gr.Radio(["soft", "medium", "hard"], label="Compression Level", value="medium")
|
| 434 |
+
poster = gr.Checkbox(label="Poster", value=False)
|
| 435 |
+
custom_base_prompt = gr.Textbox(label="Custom Base Prompt", lines=5)
|
| 436 |
+
generate_text_button = gr.Button("Generate Text")
|
| 437 |
+
text_output = gr.Textbox(label="Generated Text", lines=10)
|
| 438 |
|
| 439 |
def create_caption(image):
|
| 440 |
if image is not None:
|