Spaces:
Running on Zero
Running on Zero
File size: 812 Bytes
819c9a2 f0c2d43 db79f31 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | import gradio as gr
def _validate_target(target_b64):
if not target_b64 or target_b64.strip() in ("", "null"):
raise gr.Error("Please upload a target image.")
def _validate_selection(selected_indices):
if not selected_indices:
raise gr.Error("Please select at least one face to swap.")
def _validate_sources(selected_indices, sources):
for idx in selected_indices:
if not sources.get(str(idx)):
raise gr.Error(f"Please upload a source image for face {idx + 1}.")
def _validate_bboxes(selected_indices, bboxes):
for idx in selected_indices:
bbox = bboxes.get(str(idx))
if not bbox or len(bbox) != 4:
raise gr.Error(
f"Missing bounding box for face {idx + 1}. Please re-upload the target image."
)
|