Spaces:
Running
on
Zero
Running
on
Zero
RageshAntony
commited on
return kw
Browse files- check_app.py +5 -1
check_app.py
CHANGED
@@ -12,13 +12,17 @@ import gradio as gr
|
|
12 |
def generate_image_with_progress(pipe, prompt, num_steps, guidance_scale=None, seed=None, progress=gr.Progress()):
|
13 |
generator = None
|
14 |
if seed is not None:
|
15 |
-
generator = torch.Generator("
|
16 |
print("Start generating")
|
17 |
# Wrapper to track progress
|
18 |
def callback(pipe, step_index, timestep, callback_kwargs): # pipe, step_index, timestep, callback_kwargs
|
|
|
|
|
|
|
19 |
cur_prg = step_index / num_steps
|
20 |
print(f"Progressing {cur_prg} Step {step_index}/{num_steps}")
|
21 |
progress(cur_prg, desc=f"Step {step_index}/{num_steps}")
|
|
|
22 |
|
23 |
if isinstance(pipe, StableDiffusion3Pipeline):
|
24 |
image = pipe(
|
|
|
12 |
def generate_image_with_progress(pipe, prompt, num_steps, guidance_scale=None, seed=None, progress=gr.Progress()):
|
13 |
generator = None
|
14 |
if seed is not None:
|
15 |
+
generator = torch.Generator("cuda").manual_seed(seed)
|
16 |
print("Start generating")
|
17 |
# Wrapper to track progress
|
18 |
def callback(pipe, step_index, timestep, callback_kwargs): # pipe, step_index, timestep, callback_kwargs
|
19 |
+
print(f" callback => {pipe}, {step_index}, {timestep}, {callback_kwargs} ")
|
20 |
+
if step_index == None:
|
21 |
+
step_index = 0
|
22 |
cur_prg = step_index / num_steps
|
23 |
print(f"Progressing {cur_prg} Step {step_index}/{num_steps}")
|
24 |
progress(cur_prg, desc=f"Step {step_index}/{num_steps}")
|
25 |
+
return callback_kwargs
|
26 |
|
27 |
if isinstance(pipe, StableDiffusion3Pipeline):
|
28 |
image = pipe(
|