Jinl commited on
Commit
aa3a03e
·
1 Parent(s): f0f312f

update gradio

Browse files
app.py CHANGED
@@ -70,7 +70,7 @@ class GlobalText:
70
  self.personal_model_loaded = None
71
  self.lora_model_state_dict = {}
72
  self.device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
73
- self.refresh_stable_diffusion()
74
  self.refresh_personalized_model()
75
 
76
  self.reset_start_code()
@@ -393,14 +393,14 @@ def ui():
393
  with gr.Tab("Configs"):
394
 
395
  with gr.Row():
396
- source_image = gr.Image(label="Source Image", elem_id="img2maskimg", source="upload", interactive=True, type="pil", tool="sketch", image_mode="RGB", height=512)
397
- style_image = gr.Image(label="Style Image", elem_id="img2maskimg", source="upload", interactive=True, type="pil", tool="sketch", image_mode="RGB", height=512)
398
  with gr.Row():
399
  prompt_textbox = gr.Textbox(label="Prompt", value='head', lines=1)
400
  negative_prompt_textbox = gr.Textbox(label="Negative prompt", lines=1)
401
  # output_dir = gr.Textbox(label="output_dir", value='./results/')
402
 
403
- with gr.Row().style(equal_height=False):
404
  with gr.Column():
405
  width_slider = gr.Slider(label="Width", value=512, minimum=256, maximum=1024, step=64)
406
  height_slider = gr.Slider(label="Height", value=512, minimum=256, maximum=1024, step=64)
@@ -487,23 +487,22 @@ def ui():
487
  sam_style_btn = gr.Button(value="SAM Style")
488
  send_style_btn = gr.Button(value="Send Style")
489
  with gr.Row():
490
- source_image_sam = gr.Image(label="Source Image SAM", elem_id="SourceimgSAM", source="upload", interactive=True, type="pil", image_mode="RGB", height=512)
491
- style_image_sam = gr.Image(label="Style Image SAM", elem_id="StyleimgSAM", source="upload", interactive=True, type="pil", image_mode="RGB", height=512)
492
 
493
  with gr.Row():
494
  source_image_with_points = gr.Image(label="source Image with points", elem_id="style_image_with_points", type="pil", image_mode="RGB", height=256)
495
- source_mask = gr.Image(label="Source Mask", elem_id="img2maskimg", source="upload", interactive=True, type="numpy", image_mode="RGB", height=256)
496
 
497
  style_image_with_points = gr.Image(label="Style Image with points", elem_id="style_image_with_points", type="pil", image_mode="RGB", height=256)
498
- style_mask = gr.Image(label="Style Mask", elem_id="img2maskimg", source="upload", interactive=True, type="numpy", image_mode="RGB", height=256)
499
-
500
  gr.Examples(
501
- [[os.path.join(os.path.dirname(__file__), "images/content/1.jpg"),
502
- os.path.join(os.path.dirname(__file__), "images/style/1.jpg")],
503
-
504
- ],
505
- [source_image, style_image]
506
  )
 
507
  inputs = [
508
  source_image, style_image, source_mask, style_mask,
509
  start_step, start_layer, Style_attn_step,
 
70
  self.personal_model_loaded = None
71
  self.lora_model_state_dict = {}
72
  self.device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
73
+ # self.refresh_stable_diffusion()
74
  self.refresh_personalized_model()
75
 
76
  self.reset_start_code()
 
393
  with gr.Tab("Configs"):
394
 
395
  with gr.Row():
396
+ source_image = gr.Image(label="Source Image", elem_id="img2maskimg", sources="upload", interactive=True, type="pil",image_mode="RGB", height=512)
397
+ style_image = gr.Image(label="Style Image", elem_id="img2maskimg", sources="upload", interactive=True, type="pil", image_mode="RGB", height=512)
398
  with gr.Row():
399
  prompt_textbox = gr.Textbox(label="Prompt", value='head', lines=1)
400
  negative_prompt_textbox = gr.Textbox(label="Negative prompt", lines=1)
401
  # output_dir = gr.Textbox(label="output_dir", value='./results/')
402
 
403
+ with gr.Row(equal_height=False):
404
  with gr.Column():
405
  width_slider = gr.Slider(label="Width", value=512, minimum=256, maximum=1024, step=64)
406
  height_slider = gr.Slider(label="Height", value=512, minimum=256, maximum=1024, step=64)
 
487
  sam_style_btn = gr.Button(value="SAM Style")
488
  send_style_btn = gr.Button(value="Send Style")
489
  with gr.Row():
490
+ source_image_sam = gr.Image(label="Source Image SAM", elem_id="SourceimgSAM", sources="upload", interactive=True, type="pil", image_mode="RGB", height=512)
491
+ style_image_sam = gr.Image(label="Style Image SAM", elem_id="StyleimgSAM", sources="upload", interactive=True, type="pil", image_mode="RGB", height=512)
492
 
493
  with gr.Row():
494
  source_image_with_points = gr.Image(label="source Image with points", elem_id="style_image_with_points", type="pil", image_mode="RGB", height=256)
495
+ source_mask = gr.Image(label="Source Mask", elem_id="img2maskimg", sources="upload", interactive=True, type="numpy", image_mode="RGB", height=256)
496
 
497
  style_image_with_points = gr.Image(label="Style Image with points", elem_id="style_image_with_points", type="pil", image_mode="RGB", height=256)
498
+ style_mask = gr.Image(label="Style Mask", elem_id="img2maskimg", sources="upload", interactive=True, type="numpy", image_mode="RGB", height=256)
 
499
  gr.Examples(
500
+ [[os.path.join(os.path.dirname(__file__), "images/content/1.jpg"),
501
+ os.path.join(os.path.dirname(__file__), "images/style/1.jpg")]],
502
+ #/home/jin.liu/liujin/mycode/PortraitDiffusion/images/style/1.jpg
503
+ [source_image, style_image]
 
504
  )
505
+
506
  inputs = [
507
  source_image, style_image, source_mask, style_mask,
508
  start_step, start_layer, Style_attn_step,
app.sh CHANGED
@@ -4,4 +4,4 @@ export CUDA_VISIBLE_DEVICES=$1
4
 
5
  echo "CUDA_VISIBLE_DEVICES=$CUDA_VISIBLE_DEVICES"
6
  # export CUDA_VISIBLE_DEVICES=5
7
- python gapp.py
 
4
 
5
  echo "CUDA_VISIBLE_DEVICES=$CUDA_VISIBLE_DEVICES"
6
  # export CUDA_VISIBLE_DEVICES=5
7
+ python app.py
requirements.txt CHANGED
@@ -7,4 +7,4 @@ pytorch_lightning
7
  torchvision
8
  pillow
9
  git+https://github.com/facebookresearch/segment-anything.git
10
- gradio==3.47
 
7
  torchvision
8
  pillow
9
  git+https://github.com/facebookresearch/segment-anything.git
10
+ gradio
utils/__pycache__/__init__.cpython-38.pyc CHANGED
Binary files a/utils/__pycache__/__init__.cpython-38.pyc and b/utils/__pycache__/__init__.cpython-38.pyc differ
 
utils/__pycache__/convert_from_ckpt.cpython-38.pyc CHANGED
Binary files a/utils/__pycache__/convert_from_ckpt.cpython-38.pyc and b/utils/__pycache__/convert_from_ckpt.cpython-38.pyc differ
 
utils/__pycache__/convert_lora_safetensor_to_diffusers.cpython-38.pyc CHANGED
Binary files a/utils/__pycache__/convert_lora_safetensor_to_diffusers.cpython-38.pyc and b/utils/__pycache__/convert_lora_safetensor_to_diffusers.cpython-38.pyc differ
 
utils/__pycache__/diffuser_utils.cpython-38.pyc CHANGED
Binary files a/utils/__pycache__/diffuser_utils.cpython-38.pyc and b/utils/__pycache__/diffuser_utils.cpython-38.pyc differ
 
utils/__pycache__/free_lunch_utils.cpython-38.pyc CHANGED
Binary files a/utils/__pycache__/free_lunch_utils.cpython-38.pyc and b/utils/__pycache__/free_lunch_utils.cpython-38.pyc differ
 
utils/__pycache__/masactrl_utils.cpython-38.pyc CHANGED
Binary files a/utils/__pycache__/masactrl_utils.cpython-38.pyc and b/utils/__pycache__/masactrl_utils.cpython-38.pyc differ
 
utils/__pycache__/style_attn_control.cpython-38.pyc CHANGED
Binary files a/utils/__pycache__/style_attn_control.cpython-38.pyc and b/utils/__pycache__/style_attn_control.cpython-38.pyc differ