ChenyangSi commited on
Commit
7d2016d
1 Parent(s): f9be0ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -46
app.py CHANGED
@@ -14,10 +14,10 @@ pip_sd = pip_sd.to("cuda")
14
 
15
  pip_freeu = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
16
  pip_freeu = pip_freeu.to("cuda")
17
- # -------- freeu block registration
18
- register_free_upblock2d(pip_freeu, b1=1.2, b2=1.4, s1=0.9, s2=0.2)
19
- register_free_crossattn_upblock2d(pip_freeu, b1=1.2, b2=1.4, s1=0.9, s2=0.2)
20
- # -------- freeu block registration
21
 
22
  def infer(prompt):
23
 
@@ -110,48 +110,27 @@ with block:
110
  )
111
  btn = gr.Button("Generate image", scale=0)
112
 
113
- # sd_options = gr.Dropdown(options, value='SD1.4', label="SD options")
114
- # model_id = "CompVis/stable-diffusion-v1-4"
115
-
116
- # if sd_options == 'SD1.4':
117
- # model_id = "CompVis/stable-diffusion-v1-4"
118
- # elif sd_options == 'SD1.5':
119
- # model_id = "runwayml/stable-diffusion-v1-5"
120
- # elif sd_options == 'SD2.1':
121
- # model_id = "stabilityai/stable-diffusion-2-1"
122
-
123
- # pip_sd = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
124
- # pip_sd = pip_sd.to("cuda")
125
-
126
- # pip_freeu = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
127
- # pip_freeu = pip_freeu.to("cuda")
128
- # # -------- freeu block registration
129
- # register_free_upblock2d(pip_freeu, b1=1.2, b2=1.4, s1=0.9, s2=0.2)
130
- # register_free_crossattn_upblock2d(pip_freeu, b1=1.2, b2=1.4, s1=0.9, s2=0.2)
131
- # # -------- freeu block registration
132
-
133
- # with gr.Accordion('FreeU Parameters', open=False):
134
-
135
- b1 = gr.Slider(label='b1: backbone factor of the first stage block of decoder',
136
- minimum=1,
137
- maximum=1.6,
138
- step=0.1,
139
- value=1)
140
- b2 = gr.Slider(label='b2: backbone factor of the second stage block of decoder',
141
- minimum=1,
142
- maximum=1.6,
143
- step=0.1,
144
- value=1)
145
- s1 = gr.Slider(label='s1: skip factor of the first stage block of decoder',
146
- minimum=0,
147
- maximum=1,
148
- step=0.1,
149
- value=1)
150
- s2 = gr.Slider(label='s2: skip factor of the second stage block of decoder',
151
- minimum=0,
152
- maximum=1,
153
- step=0.1,
154
- value=1)
155
 
156
  with gr.Row():
157
  with gr.Column(min_width=256) as c1:
 
14
 
15
  pip_freeu = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
16
  pip_freeu = pip_freeu.to("cuda")
17
+ # # -------- freeu block registration
18
+ # register_free_upblock2d(pip_freeu, b1=1.2, b2=1.4, s1=0.9, s2=0.2)
19
+ # register_free_crossattn_upblock2d(pip_freeu, b1=1.2, b2=1.4, s1=0.9, s2=0.2)
20
+ # # -------- freeu block registration
21
 
22
  def infer(prompt):
23
 
 
110
  )
111
  btn = gr.Button("Generate image", scale=0)
112
 
113
+ with gr.Accordion('FreeU Parameters', open=False):
114
+ b1 = gr.Slider(label='b1: backbone factor of the first stage block of decoder',
115
+ minimum=1,
116
+ maximum=1.6,
117
+ step=0.1,
118
+ value=1)
119
+ b2 = gr.Slider(label='b2: backbone factor of the second stage block of decoder',
120
+ minimum=1,
121
+ maximum=1.6,
122
+ step=0.1,
123
+ value=1)
124
+ s1 = gr.Slider(label='s1: skip factor of the first stage block of decoder',
125
+ minimum=0,
126
+ maximum=1,
127
+ step=0.1,
128
+ value=1)
129
+ s2 = gr.Slider(label='s2: skip factor of the second stage block of decoder',
130
+ minimum=0,
131
+ maximum=1,
132
+ step=0.1,
133
+ value=1)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
 
135
  with gr.Row():
136
  with gr.Column(min_width=256) as c1: