Spaces:
Running
on
Zero
Running
on
Zero
bugfix
Browse files
app.py
CHANGED
|
@@ -31,7 +31,7 @@ os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'max_split_size_mb:30'
|
|
| 31 |
login(token=HF_TOKEN)
|
| 32 |
|
| 33 |
MAX_SEED = np.iinfo(np.int32).max
|
| 34 |
-
IMAGE_SIZE =
|
| 35 |
|
| 36 |
# init
|
| 37 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
@@ -179,6 +179,7 @@ def run_flux(
|
|
| 179 |
pipe.enable_model_cpu_offload() # for saving memory
|
| 180 |
|
| 181 |
with calculateDuration("run pipe"):
|
|
|
|
| 182 |
generated_image = pipe(
|
| 183 |
prompt=prompt,
|
| 184 |
image=image,
|
|
@@ -193,7 +194,7 @@ def run_flux(
|
|
| 193 |
max_sequence_length=256,
|
| 194 |
joint_attention_kwargs={"scale": lora_scale}
|
| 195 |
).images[0]
|
| 196 |
-
|
| 197 |
return generated_image
|
| 198 |
|
| 199 |
@spaces.GPU(duration=120)
|
|
@@ -218,7 +219,7 @@ def process(
|
|
| 218 |
bucket:str,
|
| 219 |
progress=gr.Progress(track_tqdm=True)
|
| 220 |
):
|
| 221 |
-
|
| 222 |
result = {"status": "false", "message": ""}
|
| 223 |
if not image_url:
|
| 224 |
gr.Info("please enter image url for inpaiting")
|
|
@@ -294,7 +295,7 @@ def process(
|
|
| 294 |
|
| 295 |
control_image = control_image.resize((width, height), Image.LANCZOS)
|
| 296 |
control_mode_id = control_mode_ids[control_mode]
|
| 297 |
-
|
| 298 |
try:
|
| 299 |
generated_image = run_flux(
|
| 300 |
image=image,
|
|
|
|
| 31 |
login(token=HF_TOKEN)
|
| 32 |
|
| 33 |
MAX_SEED = np.iinfo(np.int32).max
|
| 34 |
+
IMAGE_SIZE = 864
|
| 35 |
|
| 36 |
# init
|
| 37 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
|
| 179 |
pipe.enable_model_cpu_offload() # for saving memory
|
| 180 |
|
| 181 |
with calculateDuration("run pipe"):
|
| 182 |
+
print("start to run pipe")
|
| 183 |
generated_image = pipe(
|
| 184 |
prompt=prompt,
|
| 185 |
image=image,
|
|
|
|
| 194 |
max_sequence_length=256,
|
| 195 |
joint_attention_kwargs={"scale": lora_scale}
|
| 196 |
).images[0]
|
| 197 |
+
|
| 198 |
return generated_image
|
| 199 |
|
| 200 |
@spaces.GPU(duration=120)
|
|
|
|
| 219 |
bucket:str,
|
| 220 |
progress=gr.Progress(track_tqdm=True)
|
| 221 |
):
|
| 222 |
+
|
| 223 |
result = {"status": "false", "message": ""}
|
| 224 |
if not image_url:
|
| 225 |
gr.Info("please enter image url for inpaiting")
|
|
|
|
| 295 |
|
| 296 |
control_image = control_image.resize((width, height), Image.LANCZOS)
|
| 297 |
control_mode_id = control_mode_ids[control_mode]
|
| 298 |
+
|
| 299 |
try:
|
| 300 |
generated_image = run_flux(
|
| 301 |
image=image,
|