multimodalart HF staff commited on
Commit
98e159e
1 Parent(s): bc5aade

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -135,7 +135,7 @@ def save_preferences(lora_1_id, lora_1_scale, lora_2_id, lora_2_scale, prompt, g
135
  json.dump({"prompt": prompt, "file_name":image_path.name, "lora_1_id": lora_2_id, "lora_1_scale": lora_1_scale, "lora_2_id": lora_2_id, "lora_2_scale": lora_2_scale, "thumbs_direction": thumbs_direction, "seed": seed}, f)
136
  f.write("\n")
137
 
138
- return gr.update(visible=True), gr.update(visible=False), gr.update(visible=True), gr.update(interactive=False)
139
 
140
  with gr.Blocks(css=css) as demo:
141
  shuffled_items = gr.State()
@@ -178,7 +178,6 @@ with gr.Blocks(css=css) as demo:
178
  community_icon = gr.HTML(community_icon_html)
179
  loading_icon = gr.HTML(loading_icon_html)
180
  share_button = gr.Button("Share to community", elem_id="share-btn")
181
- post_eval = gr.Markdown("Thanks for evaluating. The dataset with evaluations is [here](#)", visible=False)
182
  with gr.Accordion("Advanced settings", open=False):
183
  negative_prompt = gr.Textbox(label="Negative prompt")
184
  seed = gr.Slider(label="Seed", info="-1 denotes a random seed", minimum=-1, maximum=2147483647, value=-1)
@@ -194,8 +193,8 @@ with gr.Blocks(css=css) as demo:
194
  run_btn.click(merge_and_run, inputs=[prompt, negative_prompt, shuffled_items, lora_1_scale, lora_2_scale], outputs=[output_image, post_gen_info, last_used_seed])
195
  prompt.submit(merge_and_run, inputs=[prompt, negative_prompt, shuffled_items, lora_1_scale, lora_2_scale], outputs=[output_image, post_gen_info, last_used_seed])
196
 
197
- thumbs_up.click(save_preferences, inputs=[lora_1_id, lora_1_scale, lora_2_id, lora_2_scale, prompt, output_image, gr.State("up"), seed], outputs=[post_eval, thumbs_up, thumbs_up_clicked, thumbs_down])
198
- thumbs_down.click(save_preferences, inputs=[lora_1_id, lora_1_scale, lora_2_id, lora_2_scale, prompt, output_image, gr.State("down"), seed], outputs=[post_eval, thumbs_down, thumbs_down_clicked, thumbs_up])
199
  share_button.click(None, [], [], _js=share_js)
200
  demo.queue()
201
  demo.launch()
 
135
  json.dump({"prompt": prompt, "file_name":image_path.name, "lora_1_id": lora_2_id, "lora_1_scale": lora_1_scale, "lora_2_id": lora_2_id, "lora_2_scale": lora_2_scale, "thumbs_direction": thumbs_direction, "seed": seed}, f)
136
  f.write("\n")
137
 
138
+ return gr.update(visible=False), gr.update(visible=True), gr.update(interactive=False)
139
 
140
  with gr.Blocks(css=css) as demo:
141
  shuffled_items = gr.State()
 
178
  community_icon = gr.HTML(community_icon_html)
179
  loading_icon = gr.HTML(loading_icon_html)
180
  share_button = gr.Button("Share to community", elem_id="share-btn")
 
181
  with gr.Accordion("Advanced settings", open=False):
182
  negative_prompt = gr.Textbox(label="Negative prompt")
183
  seed = gr.Slider(label="Seed", info="-1 denotes a random seed", minimum=-1, maximum=2147483647, value=-1)
 
193
  run_btn.click(merge_and_run, inputs=[prompt, negative_prompt, shuffled_items, lora_1_scale, lora_2_scale], outputs=[output_image, post_gen_info, last_used_seed])
194
  prompt.submit(merge_and_run, inputs=[prompt, negative_prompt, shuffled_items, lora_1_scale, lora_2_scale], outputs=[output_image, post_gen_info, last_used_seed])
195
 
196
+ thumbs_up.click(save_preferences, inputs=[lora_1_id, lora_1_scale, lora_2_id, lora_2_scale, prompt, output_image, gr.State("up"), seed], outputs=[thumbs_up, thumbs_up_clicked, thumbs_down])
197
+ thumbs_down.click(save_preferences, inputs=[lora_1_id, lora_1_scale, lora_2_id, lora_2_scale, prompt, output_image, gr.State("down"), seed], outputs=[thumbs_down, thumbs_down_clicked, thumbs_up])
198
  share_button.click(None, [], [], _js=share_js)
199
  demo.queue()
200
  demo.launch()