openfree commited on
Commit
2723237
1 Parent(s): 803e6af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -10
app.py CHANGED
@@ -57,7 +57,7 @@ pipe_i2i = AutoPipelineForImage2Image.from_pretrained(
57
  text_encoder_2=pipe.text_encoder_2,
58
  tokenizer_2=pipe.tokenizer_2,
59
  torch_dtype=dtype
60
- )
61
 
62
  # 업스케일링을 위한 ControlNet 모델 로드
63
  controlnet = FluxControlNetModel.from_pretrained(
@@ -74,10 +74,7 @@ pipe_controlnet = FluxControlNetPipeline(
74
  controlnet=controlnet,
75
  scheduler=pipe.scheduler
76
  # 'safety_checker'와 'feature_extractor'는 제거됨
77
- ).to(device)
78
-
79
-
80
-
81
 
82
  MAX_SEED = 2**32 - 1
83
  MAX_PIXEL_BUDGET = 1024 * 1024
@@ -667,11 +664,19 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, delete_cache=(60, 3600)) as a
667
  fn=run_lora,
668
  inputs=[prompt, input_image, image_strength, cfg_scale, steps, selected_indices, lora_scale_1, lora_scale_2, randomize_seed, seed, width, height, loras_state],
669
  outputs=[result, seed, progress_bar]
 
 
 
 
670
  )
671
  prompt.submit(
672
  fn=run_lora,
673
  inputs=[prompt, input_image, image_strength, cfg_scale, steps, selected_indices, lora_scale_1, lora_scale_2, randomize_seed, seed, width, height, loras_state],
674
  outputs=[result, seed, progress_bar]
 
 
 
 
675
  )
676
  gallery.select(
677
  fn=update_selection,
@@ -703,11 +708,6 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, delete_cache=(60, 3600)) as a
703
  inputs=[selected_indices, loras_state],
704
  outputs=[loras_state, gallery, selected_info_1, selected_info_2, selected_indices, lora_scale_1, lora_scale_2, lora_image_1, lora_image_2]
705
  )
706
- history_gallery.load(
707
- fn=update_history,
708
- inputs=[result, history_gallery],
709
- outputs=history_gallery
710
- )
711
 
712
  with gr.Tab("Upscale"):
713
  with gr.Row():
@@ -763,3 +763,4 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, delete_cache=(60, 3600)) as a
763
  app.queue()
764
  app.launch()
765
 
 
 
57
  text_encoder_2=pipe.text_encoder_2,
58
  tokenizer_2=pipe.tokenizer_2,
59
  torch_dtype=dtype
60
+ ).to(device)
61
 
62
  # 업스케일링을 위한 ControlNet 모델 로드
63
  controlnet = FluxControlNetModel.from_pretrained(
 
74
  controlnet=controlnet,
75
  scheduler=pipe.scheduler
76
  # 'safety_checker'와 'feature_extractor'는 제거됨
77
+ ).to(device) # 'torch_dtype' 제거
 
 
 
78
 
79
  MAX_SEED = 2**32 - 1
80
  MAX_PIXEL_BUDGET = 1024 * 1024
 
664
  fn=run_lora,
665
  inputs=[prompt, input_image, image_strength, cfg_scale, steps, selected_indices, lora_scale_1, lora_scale_2, randomize_seed, seed, width, height, loras_state],
666
  outputs=[result, seed, progress_bar]
667
+ ).then( # Update the history gallery
668
+ fn=lambda x, history: update_history(x, history),
669
+ inputs=[result, history_gallery],
670
+ outputs=history_gallery,
671
  )
672
  prompt.submit(
673
  fn=run_lora,
674
  inputs=[prompt, input_image, image_strength, cfg_scale, steps, selected_indices, lora_scale_1, lora_scale_2, randomize_seed, seed, width, height, loras_state],
675
  outputs=[result, seed, progress_bar]
676
+ ).then( # Update the history gallery
677
+ fn=lambda x, history: update_history(x, history),
678
+ inputs=[result, history_gallery],
679
+ outputs=history_gallery,
680
  )
681
  gallery.select(
682
  fn=update_selection,
 
708
  inputs=[selected_indices, loras_state],
709
  outputs=[loras_state, gallery, selected_info_1, selected_info_2, selected_indices, lora_scale_1, lora_scale_2, lora_image_1, lora_image_2]
710
  )
 
 
 
 
 
711
 
712
  with gr.Tab("Upscale"):
713
  with gr.Row():
 
763
  app.queue()
764
  app.launch()
765
 
766
+