Spaces:
Running
on
Zero
Running
on
Zero
Revert "fix"
Browse filesThis reverts commit 7384e48b7cf3ab9e9e53e51ab606a08de9d0722d.
app.py
CHANGED
@@ -60,33 +60,6 @@ def set_client_for_session(request: gr.Request):
|
|
60 |
|
61 |
|
62 |
@spaces.GPU(duration=100)
|
63 |
-
def run_flux(
|
64 |
-
image: Image.Image,
|
65 |
-
mask: Image.Image,
|
66 |
-
inpainting_prompt_text: str,
|
67 |
-
seed_slicer: int,
|
68 |
-
randomize_seed_checkbox: bool,
|
69 |
-
strength_slider: float,
|
70 |
-
num_inference_steps_slider: int,
|
71 |
-
width: int,
|
72 |
-
height: int,
|
73 |
-
progress=gr.Progress(track_tqdm=True)
|
74 |
-
) -> Image.Image:
|
75 |
-
if randomize_seed_checkbox:
|
76 |
-
seed_slicer = random.randint(0, MAX_SEED)
|
77 |
-
generator = torch.Generator().manual_seed(seed_slicer)
|
78 |
-
return pipe(
|
79 |
-
prompt=inpainting_prompt_text,
|
80 |
-
image=image,
|
81 |
-
mask_image=mask,
|
82 |
-
width=width,
|
83 |
-
height=height,
|
84 |
-
strength=strength_slider,
|
85 |
-
generator=generator,
|
86 |
-
num_inference_steps=num_inference_steps_slider
|
87 |
-
).images[0]
|
88 |
-
|
89 |
-
|
90 |
def process(
|
91 |
client,
|
92 |
input_image_editor: dict,
|
@@ -129,21 +102,24 @@ def process(
|
|
129 |
|
130 |
mask = mask.filter(ImageFilter.GaussianBlur(radius=5))
|
131 |
width, height = resize_image_dimensions(original_resolution_wh=image.size)
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
width=width,
|
143 |
height=height,
|
144 |
-
|
145 |
-
|
146 |
-
|
|
|
|
|
|
|
147 |
|
148 |
|
149 |
with gr.Blocks() as demo:
|
|
|
60 |
|
61 |
|
62 |
@spaces.GPU(duration=100)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
def process(
|
64 |
client,
|
65 |
input_image_editor: dict,
|
|
|
102 |
|
103 |
mask = mask.filter(ImageFilter.GaussianBlur(radius=5))
|
104 |
width, height = resize_image_dimensions(original_resolution_wh=image.size)
|
105 |
+
resized_image = image.resize((width, height), Image.LANCZOS)
|
106 |
+
resized_mask = mask.resize((width, height), Image.LANCZOS)
|
107 |
+
|
108 |
+
if randomize_seed_checkbox:
|
109 |
+
seed_slicer = random.randint(0, MAX_SEED)
|
110 |
+
generator = torch.Generator().manual_seed(seed_slicer)
|
111 |
+
result = pipe(
|
112 |
+
prompt=inpainting_prompt_text,
|
113 |
+
image=resized_image,
|
114 |
+
mask_image=resized_mask,
|
115 |
width=width,
|
116 |
height=height,
|
117 |
+
strength=strength_slider,
|
118 |
+
generator=generator,
|
119 |
+
num_inference_steps=num_inference_steps_slider
|
120 |
+
).images[0]
|
121 |
+
print('INFERENCE DONE')
|
122 |
+
return result, resized_mask
|
123 |
|
124 |
|
125 |
with gr.Blocks() as demo:
|