gokaygokay commited on
Commit
e2eb8eb
1 Parent(s): a1f105c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -32
app.py CHANGED
@@ -367,39 +367,44 @@ def create_interface():
367
  clothing = gr.Dropdown(["disabled", "random"] + CLOTHING, label="Clothing", value="random")
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")
375
- clip_l_output = gr.Textbox(label="CLIP L Output")
376
- clip_g_output = gr.Textbox(label="CLIP G Output")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
377
 
378
- generate_button.click(
379
- prompt_generator.generate_prompt,
380
- inputs=[seed, custom, subject, artform, photo_type, body_types, default_tags, roles, hairstyles,
381
- additional_details, photography_styles, device, photographer, artist, digital_artform,
382
- place, lighting, clothing, composition, pose, background],
383
- outputs=[output, gr.Number(visible=False), t5xxl_output, clip_l_output, clip_g_output]
384
- )
385
-
386
- with gr.Tab("HuggingFace Inference Text Generator"):
387
- model = gr.Dropdown(["Mixtral", "Mistral", "Llama 3", "Mistral-Nemo"], label="Model", value="Mixtral")
388
- input_text = gr.Textbox(label="Input Text", lines=5)
389
- happy_talk = gr.Checkbox(label="Happy Talk", value=True)
390
- compress = gr.Checkbox(label="Compress", value=False)
391
- compression_level = gr.Radio(["soft", "medium", "hard"], label="Compression Level", value="medium")
392
- poster = gr.Checkbox(label="Poster", value=False)
393
- custom_base_prompt = gr.Textbox(label="Custom Base Prompt", lines=5)
394
-
395
- generate_text_button = gr.Button("Generate Text")
396
- text_output = gr.Textbox(label="Generated Text", lines=10)
397
-
398
- generate_text_button.click(
399
- huggingface_node.generate,
400
- inputs=[model, input_text, happy_talk, compress, compression_level, poster, custom_base_prompt],
401
- outputs=text_output
402
- )
403
 
404
  return demo
405
 
 
367
  clothing = gr.Dropdown(["disabled", "random"] + CLOTHING, label="Clothing", value="random")
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=False)
375
+ clip_l_output = gr.Textbox(label="CLIP L Output", visible=False)
376
+ clip_g_output = gr.Textbox(label="CLIP G Output", visible=False)
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")
385
+ poster = gr.Checkbox(label="Poster", value=False)
386
+ custom_base_prompt = gr.Textbox(label="Custom Base Prompt", lines=5)
387
+
388
+ generate_text_button = gr.Button("Generate Text")
389
+ text_output = gr.Textbox(label="Generated Text", lines=10)
390
+
391
+ generate_button.click(
392
+ prompt_generator.generate_prompt,
393
+ inputs=[seed, custom, subject, artform, photo_type, body_types, default_tags, roles, hairstyles,
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, input_text, happy_talk, compress, compression_level, poster, custom_base_prompt],
406
+ outputs=text_output
407
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
408
 
409
  return demo
410