Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -18,7 +18,7 @@ pipe = DiffusionPipeline.from_pretrained(model_repo_id, torch_dtype=torch_dtype)
|
|
18 |
pipe = pipe.to(device)
|
19 |
|
20 |
MAX_SEED = np.iinfo(np.int32).max
|
21 |
-
MAX_IMAGE_SIZE =
|
22 |
|
23 |
def calculate_duration(width, height, num_inference_steps):
|
24 |
# Примерная оценка времени выполнения
|
@@ -140,67 +140,7 @@ with gr.Blocks(theme=CustomTheme(), css=css) as demo:
|
|
140 |
|
141 |
result = gr.Image(label="Result", show_label=False)
|
142 |
|
143 |
-
|
144 |
-
negative_prompt = gr.Text(
|
145 |
-
label="Negative Prompt",
|
146 |
-
max_lines=1,
|
147 |
-
placeholder="Enter a negative prompt",
|
148 |
-
visible=False,
|
149 |
-
)
|
150 |
-
|
151 |
-
seed = gr.Slider(
|
152 |
-
label="Seed",
|
153 |
-
minimum=0,
|
154 |
-
maximum=MAX_SEED,
|
155 |
-
step=1,
|
156 |
-
value=0,
|
157 |
-
)
|
158 |
-
|
159 |
-
randomize_seed = gr.Checkbox(label="Randomize Seed", value=True)
|
160 |
-
|
161 |
-
with gr.Row():
|
162 |
-
width = gr.Slider(
|
163 |
-
label="Width",
|
164 |
-
minimum=512,
|
165 |
-
maximum=MAX_IMAGE_SIZE,
|
166 |
-
step=32,
|
167 |
-
value=1024,
|
168 |
-
)
|
169 |
-
|
170 |
-
height = gr.Slider(
|
171 |
-
label="Height",
|
172 |
-
minimum=512,
|
173 |
-
maximum=MAX_IMAGE_SIZE,
|
174 |
-
step=32,
|
175 |
-
value=1024,
|
176 |
-
)
|
177 |
-
|
178 |
-
with gr.Row():
|
179 |
-
guidance_scale = gr.Slider(
|
180 |
-
label="Guidance Scale",
|
181 |
-
minimum=0.0,
|
182 |
-
maximum=7.5,
|
183 |
-
step=0.1,
|
184 |
-
value=4.5,
|
185 |
-
)
|
186 |
-
|
187 |
-
num_inference_steps = gr.Slider(
|
188 |
-
label="Number of Inference Steps",
|
189 |
-
minimum=1,
|
190 |
-
maximum=50,
|
191 |
-
step=1,
|
192 |
-
value=40,
|
193 |
-
)
|
194 |
-
|
195 |
-
gr.Examples(
|
196 |
-
examples=examples,
|
197 |
-
inputs=[prompt],
|
198 |
-
outputs=[result, seed],
|
199 |
-
fn=infer,
|
200 |
-
cache_examples=True,
|
201 |
-
cache_mode="lazy"
|
202 |
-
)
|
203 |
-
|
204 |
# Use click method for the button and submit for the text field
|
205 |
run_button.click(
|
206 |
fn=infer,
|
|
|
18 |
pipe = pipe.to(device)
|
19 |
|
20 |
MAX_SEED = np.iinfo(np.int32).max
|
21 |
+
MAX_IMAGE_SIZE = 512
|
22 |
|
23 |
def calculate_duration(width, height, num_inference_steps):
|
24 |
# Примерная оценка времени выполнения
|
|
|
140 |
|
141 |
result = gr.Image(label="Result", show_label=False)
|
142 |
|
143 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
# Use click method for the button and submit for the text field
|
145 |
run_button.click(
|
146 |
fn=infer,
|