gokaygokay commited on
Commit
c2401c0
1 Parent(s): e33e382

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +55 -47
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
- seed = gr.Number(label="Seed", value=0)
387
- custom = gr.Textbox(label="Custom")
388
- subject = gr.Textbox(label="Subject")
389
- artform = gr.Dropdown(["disabled", "random"] + ARTFORM, label="Artform", value="photography")
390
- photo_type = gr.Dropdown(["disabled", "random"] + PHOTO_TYPE, label="Photo Type", value="random")
391
- body_types = gr.Dropdown(["disabled", "random"] + BODY_TYPES, label="Body Types", value="random")
392
- default_tags = gr.Dropdown(["disabled", "random"] + DEFAULT_TAGS, label="Default Tags", value="random")
393
- roles = gr.Dropdown(["disabled", "random"] + ROLES, label="Roles", value="random")
394
- hairstyles = gr.Dropdown(["disabled", "random"] + HAIRSTYLES, label="Hairstyles", value="random")
395
- additional_details = gr.Dropdown(["disabled", "random"] + ADDITIONAL_DETAILS, label="Additional Details", value="random")
396
- photography_styles = gr.Dropdown(["disabled", "random"] + PHOTOGRAPHY_STYLES, label="Photography Styles", value="random")
397
- with gr.Column():
398
- device = gr.Dropdown(["disabled", "random"] + DEVICE, label="Device", value="random")
399
- photographer = gr.Dropdown(["disabled", "random"] + PHOTOGRAPHER, label="Photographer", value="random")
400
- artist = gr.Dropdown(["disabled", "random"] + ARTIST, label="Artist", value="random")
401
- digital_artform = gr.Dropdown(["disabled", "random"] + DIGITAL_ARTFORM, label="Digital Artform", value="random")
402
- place = gr.Dropdown(["disabled", "random"] + PLACE, label="Place", value="random")
403
- lighting = gr.Dropdown(["disabled", "random"] + LIGHTING, label="Lighting", value="random")
404
- clothing = gr.Dropdown(["disabled", "random"] + CLOTHING, label="Clothing", value="random")
405
- composition = gr.Dropdown(["disabled", "random"] + COMPOSITION, label="Composition", value="random")
406
- pose = gr.Dropdown(["disabled", "random"] + POSE, label="Pose", value="random")
407
- background = gr.Dropdown(["disabled", "random"] + BACKGROUND, label="Background", value="random")
408
- with gr.Column():
409
- input_image = gr.Image(label="Input Image (optional)")
410
- caption_output = gr.Textbox(label="Generated Caption", lines=3)
411
- create_caption_button = gr.Button("Create Caption")
412
- generate_button = gr.Button("Generate Prompt")
413
- output = gr.Textbox(label="Generated Prompt / Input Text", lines=5)
414
- add_caption_button = gr.Button("Add Caption to Prompt")
415
- t5xxl_output = gr.Textbox(label="T5XXL Output", visible=True)
416
- clip_l_output = gr.Textbox(label="CLIP L Output", visible=True)
417
- clip_g_output = gr.Textbox(label="CLIP G Output", visible=True)
418
-
419
- with gr.Column():
420
- # HuggingFace Inference Text Generator inputs
421
- model = gr.Dropdown(["Mixtral", "Mistral", "Llama 3", "Mistral-Nemo"], label="Model", value="Mixtral")
422
- happy_talk = gr.Checkbox(label="Happy Talk", value=True)
423
- compress = gr.Checkbox(label="Compress", value=False)
424
- compression_level = gr.Radio(["soft", "medium", "hard"], label="Compression Level", value="medium")
425
- poster = gr.Checkbox(label="Poster", value=False)
426
- custom_base_prompt = gr.Textbox(label="Custom Base Prompt", lines=5)
427
-
428
- generate_text_button = gr.Button("Generate Text")
429
- text_output = gr.Textbox(label="Generated Text", lines=10)
 
 
 
 
 
 
 
 
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: