multimodalart HF staff commited on
Commit
a56c826
1 Parent(s): 88dfda8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -76,8 +76,11 @@ def shuffle_images():
76
  description_1, trigger_word_1 = get_description(two_shuffled_items[0])
77
  description_2, trigger_word_2 = get_description(two_shuffled_items[1])
78
 
 
 
79
  prompt = gr.update(value=f"{trigger_word_1} {trigger_word_2}")
80
- return title_1,description_1,title_2,description_2,prompt, two_shuffled_items
 
81
 
82
  with gr.Blocks(css=css) as demo:
83
  shuffled_items = gr.State()
@@ -90,12 +93,12 @@ with gr.Blocks(css=css) as demo:
90
  with gr.Row():
91
  with gr.Column(min_width=10, scale=6):
92
  lora_1 = gr.Image(interactive=False, height=300)
93
- lora_1_prompt = gr.Markdown()
94
  with gr.Column(min_width=10, scale=1, elem_id="plus_column"):
95
  plus = gr.HTML("+", elem_id="plus_button")
96
  with gr.Column(min_width=10, scale=6):
97
  lora_2 = gr.Image(interactive=False, height=300)
98
- lora_2_prompt = gr.Markdown()
99
  with gr.Row():
100
  prompt = gr.Textbox(label="Your prompt", info="arrange the trigger words of the two LoRAs in a coherent sentence", interactive=True, elem_id="prompt")
101
  run_btn = gr.Button("Run", elem_id="run_button")
@@ -108,10 +111,11 @@ with gr.Blocks(css=css) as demo:
108
  lora_2_scale = gr.Slider(label="LoRa 2 Scale", minimum=0, maximum=1, step=0.1, value=0.7)
109
  shuffle_button = gr.Button("Reshuffle LoRAs!")
110
 
111
- demo.load(shuffle_images, inputs=[], outputs=[lora_1,lora_1_prompt,lora_2,lora_2_prompt, prompt, shuffled_items], queue=False, show_progress="hidden")
112
- shuffle_button.click(shuffle_images, outputs=[lora_1,lora_1_prompt,lora_2,lora_2_prompt, prompt, shuffled_items], queue=False, show_progress="hidden")
113
 
114
  run_btn.click(merge_and_run, inputs=[prompt, negative_prompt, shuffled_items, lora_1_scale, lora_2_scale], outputs=[output_image])
115
  prompt.submit(merge_and_run, inputs=[prompt, negative_prompt, shuffled_items, lora_1_scale, lora_2_scale], outputs=[output_image])
 
116
  demo.queue()
117
  demo.launch()
 
76
  description_1, trigger_word_1 = get_description(two_shuffled_items[0])
77
  description_2, trigger_word_2 = get_description(two_shuffled_items[1])
78
 
79
+ prompt_description_1 = gr.update(value=description_1, visible=True)
80
+ prompt_description_2 = gr.update(value=description_2, visible=True)
81
  prompt = gr.update(value=f"{trigger_word_1} {trigger_word_2}")
82
+
83
+ return title_1, prompt_description_1, title_2, prompt_description_2, prompt, two_shuffled_items
84
 
85
  with gr.Blocks(css=css) as demo:
86
  shuffled_items = gr.State()
 
93
  with gr.Row():
94
  with gr.Column(min_width=10, scale=6):
95
  lora_1 = gr.Image(interactive=False, height=300)
96
+ lora_1_prompt = gr.Markdown(visible=False)
97
  with gr.Column(min_width=10, scale=1, elem_id="plus_column"):
98
  plus = gr.HTML("+", elem_id="plus_button")
99
  with gr.Column(min_width=10, scale=6):
100
  lora_2 = gr.Image(interactive=False, height=300)
101
+ lora_2_prompt = gr.Markdown(visible=False)
102
  with gr.Row():
103
  prompt = gr.Textbox(label="Your prompt", info="arrange the trigger words of the two LoRAs in a coherent sentence", interactive=True, elem_id="prompt")
104
  run_btn = gr.Button("Run", elem_id="run_button")
 
111
  lora_2_scale = gr.Slider(label="LoRa 2 Scale", minimum=0, maximum=1, step=0.1, value=0.7)
112
  shuffle_button = gr.Button("Reshuffle LoRAs!")
113
 
114
+ demo.load(shuffle_images, inputs=[], outputs=[lora_1, lora_1_prompt, lora_2, lora_2_prompt, prompt, shuffled_items], queue=False, show_progress="hidden")
115
+ shuffle_button.click(shuffle_images, outputs=[lora_1, lora_1_prompt, lora_2, lora_2_prompt, prompt, shuffled_items], queue=False, show_progress="hidden")
116
 
117
  run_btn.click(merge_and_run, inputs=[prompt, negative_prompt, shuffled_items, lora_1_scale, lora_2_scale], outputs=[output_image])
118
  prompt.submit(merge_and_run, inputs=[prompt, negative_prompt, shuffled_items, lora_1_scale, lora_2_scale], outputs=[output_image])
119
+
120
  demo.queue()
121
  demo.launch()