r3gm commited on
Commit
09775e6
1 Parent(s): 6ae5017

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -9
app.py CHANGED
@@ -7,6 +7,7 @@ from stablepy import (
7
  check_scheduler_compatibility,
8
  TASK_AND_PREPROCESSORS,
9
  FACE_RESTORATION_MODELS,
 
10
  )
11
  from constants import (
12
  DIRECTORY_MODELS,
@@ -37,15 +38,12 @@ from constants import (
37
  EXAMPLES_GUI,
38
  RESOURCES,
39
  DIFFUSERS_CONTROLNET_MODEL,
 
 
40
  )
41
  from stablepy.diffusers_vanilla.style_prompt_config import STYLE_NAMES
42
  import torch
43
  import re
44
- from stablepy import (
45
- scheduler_names,
46
- IP_ADAPTERS_SD,
47
- IP_ADAPTERS_SDXL,
48
- )
49
  import time
50
  from PIL import ImageFile
51
  from utils import (
@@ -72,7 +70,9 @@ import warnings
72
  from stablepy import logger
73
  from diffusers import FluxPipeline
74
  # import urllib.parse
 
75
 
 
76
  ImageFile.LOAD_TRUNCATED_IMAGES = True
77
  torch.backends.cuda.matmul.allow_tf32 = True
78
  # os.environ["PYTORCH_NO_CUDA_MEMORY_CACHING"] = "1"
@@ -966,9 +966,6 @@ with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
966
 
967
  with gr.Accordion("IP-Adapter", open=False, visible=True):
968
 
969
- IP_MODELS = sorted(list(set(IP_ADAPTERS_SD + IP_ADAPTERS_SDXL)))
970
- MODE_IP_OPTIONS = ["original", "style", "layout", "style+layout"]
971
-
972
  with gr.Accordion("IP-Adapter 1", open=False, visible=True):
973
  image_ip1 = gr.Image(label="IP Image", type="filepath")
974
  mask_ip1 = gr.Image(label="IP Mask", type="filepath")
@@ -993,7 +990,7 @@ with gr.Blocks(theme="NoCrypt/miku", css=CSS) as app:
993
  minimum=64, maximum=2048, step=64, value=1024, label="Image Resolution",
994
  info="The maximum proportional size of the generated image based on the uploaded image."
995
  )
996
- controlnet_model_gui = gr.Dropdown(label="ControlNet model", choices=DIFFUSERS_CONTROLNET_MODEL, value=DIFFUSERS_CONTROLNET_MODEL[0])
997
  control_net_output_scaling_gui = gr.Slider(minimum=0, maximum=5.0, step=0.1, value=1, label="ControlNet Output Scaling in UNet")
998
  control_net_start_threshold_gui = gr.Slider(minimum=0, maximum=1, step=0.01, value=0, label="ControlNet Start Threshold (%)")
999
  control_net_stop_threshold_gui = gr.Slider(minimum=0, maximum=1, step=0.01, value=1, label="ControlNet Stop Threshold (%)")
 
7
  check_scheduler_compatibility,
8
  TASK_AND_PREPROCESSORS,
9
  FACE_RESTORATION_MODELS,
10
+ scheduler_names,
11
  )
12
  from constants import (
13
  DIRECTORY_MODELS,
 
38
  EXAMPLES_GUI,
39
  RESOURCES,
40
  DIFFUSERS_CONTROLNET_MODEL,
41
+ IP_MODELS,
42
+ MODE_IP_OPTIONS,
43
  )
44
  from stablepy.diffusers_vanilla.style_prompt_config import STYLE_NAMES
45
  import torch
46
  import re
 
 
 
 
 
47
  import time
48
  from PIL import ImageFile
49
  from utils import (
 
70
  from stablepy import logger
71
  from diffusers import FluxPipeline
72
  # import urllib.parse
73
+ import subprocess
74
 
75
+ subprocess.run("rm -rf /data-nvme/zerogpu-offload/*", env={}, shell=True)
76
  ImageFile.LOAD_TRUNCATED_IMAGES = True
77
  torch.backends.cuda.matmul.allow_tf32 = True
78
  # os.environ["PYTORCH_NO_CUDA_MEMORY_CACHING"] = "1"
 
966
 
967
  with gr.Accordion("IP-Adapter", open=False, visible=True):
968
 
 
 
 
969
  with gr.Accordion("IP-Adapter 1", open=False, visible=True):
970
  image_ip1 = gr.Image(label="IP Image", type="filepath")
971
  mask_ip1 = gr.Image(label="IP Mask", type="filepath")
 
990
  minimum=64, maximum=2048, step=64, value=1024, label="Image Resolution",
991
  info="The maximum proportional size of the generated image based on the uploaded image."
992
  )
993
+ controlnet_model_gui = gr.Dropdown(label="ControlNet model", choices=DIFFUSERS_CONTROLNET_MODEL, value=DIFFUSERS_CONTROLNET_MODEL[0], allow_custom_value=True)
994
  control_net_output_scaling_gui = gr.Slider(minimum=0, maximum=5.0, step=0.1, value=1, label="ControlNet Output Scaling in UNet")
995
  control_net_start_threshold_gui = gr.Slider(minimum=0, maximum=1, step=0.01, value=0, label="ControlNet Start Threshold (%)")
996
  control_net_stop_threshold_gui = gr.Slider(minimum=0, maximum=1, step=0.01, value=1, label="ControlNet Stop Threshold (%)")