dn commited on
Commit
c97b27f
1 Parent(s): c3743b9

update demo

Browse files
Files changed (3) hide show
  1. .gitignore +1 -0
  2. app.py +22 -19
  3. config_cuda.yaml +1 -1
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ *.pyc
app.py CHANGED
@@ -67,7 +67,7 @@ def process_multi_wrapper_only_show_rendered(rendered_txt_0, rendered_txt_1, ren
67
  only_show_rendered_image=True)
68
 
69
 
70
- cfg = OmegaConf.load("config.yaml")
71
  model = load_model_from_config(cfg, "model_wo_ema.ckpt", verbose=True)
72
  # model = load_model_from_config(cfg, "model_states.pt", verbose=True)
73
  # model = load_model_from_config(cfg, "model.ckpt", verbose=True)
@@ -104,15 +104,15 @@ with block:
104
  with gr.Row():
105
  for i in range(4):
106
  with gr.Column():
107
- exec(f"""rendered_txt_{i} = gr.Textbox(label=f"rendered_txt {i+1}")""")
108
 
109
  with gr.Accordion(f"Advanced options {i+1}", open=False):
110
- exec(f"""width_{i} = gr.Slider(label="bbox_width", minimum=0., maximum=1, value=0.3, step=0.01) """)
111
- exec(f"""ratio_{i} = gr.Slider(label="bbox_width_height_ratio", minimum=0., maximum=5, value=0., step=0.02) """)
112
- exec(f"""top_left_x_{i} = gr.Slider(label="bbox_top_left_x", minimum=0., maximum=1, value={0.35 - 0.25 * math.cos(math.pi * i)}, step=0.01) """)
113
- exec(f"""top_left_y_{i} = gr.Slider(label="bbox_top_left_y", minimum=0., maximum=1, value={0.1 if i < 2 else 0.6}, step=0.01) """)
114
- exec(f"""yaw_{i} = gr.Slider(label="bbox_yaw", minimum=-180, maximum=180, value=0, step=5) """)
115
- exec(f"""num_rows_{i} = gr.Slider(label="num_rows", minimum=1, maximum=4, value=1, step=1) """)
116
 
117
  with gr.Row():
118
  with gr.Column():
@@ -122,17 +122,20 @@ with block:
122
  show_render_button = gr.Button(value="Only Rendered")
123
 
124
  with gr.Accordion("Shared Advanced options", open=False):
125
- shared_num_samples = gr.Slider(label="Images", minimum=1, maximum=12, value=1, step=1)
126
- shared_image_resolution = gr.Slider(label="Image Resolution", minimum=256, maximum=768, value=512, step=64)
127
- shared_strength = gr.Slider(label="Control Strength", minimum=0.0, maximum=2.0, value=1.0, step=0.01)
128
- shared_guess_mode = gr.Checkbox(label='Guess Mode', value=False)
129
- shared_scale = gr.Slider(label="Guidance Scale", minimum=0.1, maximum=30.0, value=9.0, step=0.1)
130
- shared_ddim_steps = gr.Slider(label="Steps", minimum=1, maximum=100, value=20, step=1)
131
- shared_seed = gr.Slider(label="Seed", minimum=-1, maximum=2147483647, step=1, randomize=True)
132
- shared_eta = gr.Number(label="eta (DDIM)", value=0.0)
133
- shared_a_prompt = gr.Textbox(label="Added Prompt", value='best quality, extremely detailed')
134
- shared_n_prompt = gr.Textbox(label="Negative Prompt",
135
- value='longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality')
 
 
 
136
 
137
  with gr.Row():
138
  result_gallery = gr.Gallery(label='Output', show_label=False, elem_id="gallery").style(grid=2, height='auto')
 
67
  only_show_rendered_image=True)
68
 
69
 
70
+ cfg = OmegaConf.load("config_cuda.yaml")
71
  model = load_model_from_config(cfg, "model_wo_ema.ckpt", verbose=True)
72
  # model = load_model_from_config(cfg, "model_states.pt", verbose=True)
73
  # model = load_model_from_config(cfg, "model.ckpt", verbose=True)
 
104
  with gr.Row():
105
  for i in range(4):
106
  with gr.Column():
107
+ exec(f"""rendered_txt_{i} = gr.Textbox(label=f"Render Text {i+1}")""")
108
 
109
  with gr.Accordion(f"Advanced options {i+1}", open=False):
110
+ exec(f"""width_{i} = gr.Slider(label="Bbox Width", minimum=0., maximum=1, value=0.3, step=0.01) """)
111
+ exec(f"""ratio_{i} = gr.Slider(label="Bbox_width_height_ratio", minimum=0., maximum=5, value=0., step=0.02, visible=False) """)
112
+ exec(f"""top_left_x_{i} = gr.Slider(label="Bbox Top Left x", minimum=0., maximum=1, value={0.35 - 0.25 * math.cos(math.pi * i)}, step=0.01) """)
113
+ exec(f"""top_left_y_{i} = gr.Slider(label="Bbox Top Left y", minimum=0., maximum=1, value={0.1 if i < 2 else 0.6}, step=0.01) """)
114
+ exec(f"""yaw_{i} = gr.Slider(label="Bbox Yaw", minimum=-180, maximum=180, value=0, step=5) """)
115
+ exec(f"""num_rows_{i} = gr.Slider(label="num_rows", minimum=1, maximum=4, value=1, step=1, visible=False) """)
116
 
117
  with gr.Row():
118
  with gr.Column():
 
122
  show_render_button = gr.Button(value="Only Rendered")
123
 
124
  with gr.Accordion("Shared Advanced options", open=False):
125
+ with gr.Row():
126
+ shared_num_samples = gr.Slider(label="Images", minimum=1, maximum=12, value=1, step=1)
127
+ shared_image_resolution = gr.Slider(label="Image Resolution", minimum=256, maximum=768, value=512, step=64, visible=False)
128
+ shared_strength = gr.Slider(label="Control Strength", minimum=0.0, maximum=2.0, value=1.0, step=0.01, visible=False)
129
+ shared_guess_mode = gr.Checkbox(label='Guess Mode', value=False, visible=False)
130
+ shared_seed = gr.Slider(label="Seed", minimum=-1, maximum=2147483647, step=1, randomize=True)
131
+ with gr.Row():
132
+ shared_scale = gr.Slider(label="Guidance Scale", minimum=0.1, maximum=30.0, value=9.0, step=0.1)
133
+ shared_ddim_steps = gr.Slider(label="Steps", minimum=1, maximum=100, value=20, step=1)
134
+ shared_eta = gr.Number(label="eta (DDIM)", value=0.0, visible=False)
135
+ with gr.Row():
136
+ shared_a_prompt = gr.Textbox(label="Added Prompt", value='best quality, extremely detailed')
137
+ shared_n_prompt = gr.Textbox(label="Negative Prompt",
138
+ value='longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality')
139
 
140
  with gr.Row():
141
  result_gallery = gr.Gallery(label='Output', show_label=False, elem_id="gallery").style(grid=2, height='auto')
config_cuda.yaml CHANGED
@@ -18,7 +18,7 @@ model:
18
  scale_factor: 0.18215
19
  only_mid_control: False
20
  sd_locked: True
21
- use_ema: True #TODO: specify
22
 
23
  control_stage_config:
24
  target: cldm.cldm.ControlNet
 
18
  scale_factor: 0.18215
19
  only_mid_control: False
20
  sd_locked: True
21
+ use_ema: False #TODO: specify
22
 
23
  control_stage_config:
24
  target: cldm.cldm.ControlNet