zhiweili commited on
Commit
3a87f75
1 Parent(s): 33f34eb

change app

Browse files
Files changed (3) hide show
  1. app.py +1 -1
  2. app_haircolor.py +7 -7
  3. app_haircolor_inpaint.py +2 -2
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import gradio as gr
2
 
3
- from app_haircolor_inpaint import create_demo as create_demo_haircolor
4
 
5
  with gr.Blocks(css="style.css") as demo:
6
  with gr.Tabs():
 
1
  import gradio as gr
2
 
3
+ from app_haircolor import create_demo as create_demo_haircolor
4
 
5
  with gr.Blocks(css="style.css") as demo:
6
  with gr.Tabs():
app_haircolor.py CHANGED
@@ -19,7 +19,7 @@ from controlnet_aux import (
19
  CannyDetector,
20
  )
21
 
22
- BASE_MODEL = "stabilityai/stable-diffusion-xl-base-1.0"
23
  DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
24
 
25
  DEFAULT_EDIT_PROMPT = "a woman, blue hair, high detailed"
@@ -75,9 +75,9 @@ def image_to_image(
75
  run_task_time = 0
76
  time_cost_str = ''
77
  run_task_time, time_cost_str = get_time_cost(run_task_time, time_cost_str)
78
- lineart_image = lineart_detector(input_image, int(generate_size*0.375), generate_size)
79
  run_task_time, time_cost_str = get_time_cost(run_task_time, time_cost_str)
80
- canny_image = canndy_detector(input_image, int(generate_size*0.375), generate_size)
81
  run_task_time, time_cost_str = get_time_cost(run_task_time, time_cost_str)
82
 
83
  cond_image = [lineart_image, canny_image]
@@ -118,17 +118,17 @@ def create_demo() -> gr.Blocks:
118
  with gr.Row():
119
  with gr.Column():
120
  edit_prompt = gr.Textbox(lines=1, label="Edit Prompt", value=DEFAULT_EDIT_PROMPT)
121
- generate_size = gr.Number(label="Generate Size", value=1024)
122
  seed = gr.Number(label="Seed", value=8)
123
  category = gr.Textbox(label="Category", value=DEFAULT_CATEGORY, visible=False)
124
  with gr.Column():
125
- num_steps = gr.Slider(minimum=1, maximum=100, value=30, step=1, label="Num Steps")
126
  guidance_scale = gr.Slider(minimum=0, maximum=30, value=5, step=0.5, label="Guidance Scale")
127
  mask_expansion = gr.Number(label="Mask Expansion", value=50, visible=True)
128
  with gr.Column():
129
  mask_dilation = gr.Slider(minimum=0, maximum=10, value=2, step=1, label="Mask Dilation")
130
- lineart_scale = gr.Slider(minimum=0, maximum=2, value=1, step=0.1, label="Lineart Scale")
131
- canny_scale = gr.Slider(minimum=0, maximum=2, value=0.5, step=0.1, label="Canny Scale")
132
  g_btn = gr.Button("Edit Image")
133
 
134
  with gr.Row():
 
19
  CannyDetector,
20
  )
21
 
22
+ BASE_MODEL = "SG161222/RealVisXL_V5.0_Lightning"
23
  DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
24
 
25
  DEFAULT_EDIT_PROMPT = "a woman, blue hair, high detailed"
 
75
  run_task_time = 0
76
  time_cost_str = ''
77
  run_task_time, time_cost_str = get_time_cost(run_task_time, time_cost_str)
78
+ lineart_image = lineart_detector(input_image, 384, generate_size)
79
  run_task_time, time_cost_str = get_time_cost(run_task_time, time_cost_str)
80
+ canny_image = canndy_detector(input_image, 384, generate_size)
81
  run_task_time, time_cost_str = get_time_cost(run_task_time, time_cost_str)
82
 
83
  cond_image = [lineart_image, canny_image]
 
118
  with gr.Row():
119
  with gr.Column():
120
  edit_prompt = gr.Textbox(lines=1, label="Edit Prompt", value=DEFAULT_EDIT_PROMPT)
121
+ generate_size = gr.Number(label="Generate Size", value=512)
122
  seed = gr.Number(label="Seed", value=8)
123
  category = gr.Textbox(label="Category", value=DEFAULT_CATEGORY, visible=False)
124
  with gr.Column():
125
+ num_steps = gr.Slider(minimum=1, maximum=100, value=10, step=1, label="Num Steps")
126
  guidance_scale = gr.Slider(minimum=0, maximum=30, value=5, step=0.5, label="Guidance Scale")
127
  mask_expansion = gr.Number(label="Mask Expansion", value=50, visible=True)
128
  with gr.Column():
129
  mask_dilation = gr.Slider(minimum=0, maximum=10, value=2, step=1, label="Mask Dilation")
130
+ lineart_scale = gr.Slider(minimum=0, maximum=2, value=0.3, step=0.1, label="Lineart Scale")
131
+ canny_scale = gr.Slider(minimum=0, maximum=2, value=0.7, step=0.1, label="Canny Scale")
132
  g_btn = gr.Button("Edit Image")
133
 
134
  with gr.Row():
app_haircolor_inpaint.py CHANGED
@@ -19,8 +19,8 @@ from controlnet_aux import (
19
  CannyDetector,
20
  )
21
 
22
- # BASE_MODEL = "SG161222/RealVisXL_V5.0_Lightning"
23
- BASE_MODEL = "RunDiffusion/Juggernaut-XL-v9"
24
  DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
25
 
26
  DEFAULT_EDIT_PROMPT = "a woman, blue hair, high detailed"
 
19
  CannyDetector,
20
  )
21
 
22
+ BASE_MODEL = "SG161222/RealVisXL_V5.0_Lightning"
23
+ # BASE_MODEL = "RunDiffusion/Juggernaut-XL-v9"
24
  DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
25
 
26
  DEFAULT_EDIT_PROMPT = "a woman, blue hair, high detailed"