Spaces:
Running
on
Zero
Running
on
Zero
bugfix
Browse files
app.py
CHANGED
@@ -222,6 +222,7 @@ def process(
|
|
222 |
image = image.resize((width, height), Image.LANCZOS)
|
223 |
mask = mask.resize((width, height), Image.LANCZOS)
|
224 |
mask = process_mask(mask, mask_inflation=mask_inflation_slider, mask_blur=mask_blur_slider)
|
|
|
225 |
image = run_flux(
|
226 |
image=image,
|
227 |
mask=mask,
|
@@ -237,8 +238,9 @@ def process(
|
|
237 |
)
|
238 |
|
239 |
if upload_to_r2:
|
240 |
-
|
241 |
-
|
|
|
242 |
else:
|
243 |
result = {"status": "success", "message": "Image generated but not uploaded"}
|
244 |
|
@@ -369,8 +371,7 @@ with gr.Blocks() as demo:
|
|
369 |
secret_key = gr.Textbox(label="Secret Key", placeholder="Enter R2 secret key here")
|
370 |
|
371 |
with gr.Column():
|
372 |
-
|
373 |
-
output_json_component = gr.Textbox()
|
374 |
|
375 |
submit_button_component.click(
|
376 |
fn=process,
|
|
|
222 |
image = image.resize((width, height), Image.LANCZOS)
|
223 |
mask = mask.resize((width, height), Image.LANCZOS)
|
224 |
mask = process_mask(mask, mask_inflation=mask_inflation_slider, mask_blur=mask_blur_slider)
|
225 |
+
|
226 |
image = run_flux(
|
227 |
image=image,
|
228 |
mask=mask,
|
|
|
238 |
)
|
239 |
|
240 |
if upload_to_r2:
|
241 |
+
with calculateDuration("upload image"):
|
242 |
+
url = upload_image_to_r2(image, account_id, access_key, secret_key, bucket)
|
243 |
+
result = {"status": "success", "url": url}
|
244 |
else:
|
245 |
result = {"status": "success", "message": "Image generated but not uploaded"}
|
246 |
|
|
|
371 |
secret_key = gr.Textbox(label="Secret Key", placeholder="Enter R2 secret key here")
|
372 |
|
373 |
with gr.Column():
|
374 |
+
output_json_component = gr.Code(label="JSON Result", language="json")
|
|
|
375 |
|
376 |
submit_button_component.click(
|
377 |
fn=process,
|