Swimsuit Outfit Editor
Create one polished photorealistic bikini edit from the source. Attempt to preserve the subject and scene, disclose observable drift, and return the exact prompt and parameters used.
Enforce the safety boundary
Before processing media:
- Confirm the depicted person is clearly an adult (18+). If the person may be under 18 or age is unclear, stop. Do not infer adulthood from makeup, clothing, or context.
- Confirm the user owns the media or has permission from the depicted adult to make this clothing edit. Stop if consent or authorization is missing.
- Keep the bikini opaque, non-explicit, and suitable for a mainstream swimwear catalog. Refuse nudity, transparent clothing, fetish styling, or sexualized body emphasis.
- Preserve body proportions. Do not enlarge sexual characteristics, reshape the body, alter the pose, or expose more skin than the approved swimsuit requires.
- Do not upload a local or private file to a public host without explicit approval. The current Marketplace contract reads
FileData.path and ignores FileData.url; never embed a local file in url. Disclose that the provider may return hosted result URLs.
Use a tasteful opaque two-piece bikini with moderate coverage in a solid neutral color when the user does not specify the design. Do not silently substitute a one-piece swimsuit, rash guard, wetsuit, athletic bodysuit, swim shorts, or long-sleeve sports swimwear.
Run the preflight
- Identify whether the input is an image or video.
- Inspect the source at original resolution. Record dimensions, aspect ratio, subject count, occlusions, pose, lighting, and background complexity.
- Clarify which person or people to edit if more than one person appears. Do not edit bystanders. If a mixed group is selected and the requested bikini assignment is ambiguous, require a target-specific garment mapping.
- Read [references/api-contract.md](references/api-contract.md) and refresh the linked live API description and price.
- Run both transport checks in the API contract before any paid submission. Require a healthy SSE result route. For a local file, also require the upload route to be registered and to return a usable server path. Stop before payment if either required route fails.
- Present the spend plan before making any paid request. At the verified price of $0.02 per submission, the single image result costs $0.02 total. Include no retry budget unless the user explicitly approves it.
- Before payment, show whether the run will use a newly signed mandate or reuse an existing one. Verify and report its ID,
signed status, currency, remaining budget, and expiry. Never imply that payment is unsigned merely because no new signing page appeared.
- Treat explicit approval of the edit as distinct from approval of the stated API spend. Do not submit a paid job until the user approves the current total.
Route the media
Image input
- Put the target image first and optional bikini reference images afterward.
- Use the exact current
FileData contract: put the image location in image.path, include meta._type = gradio.FileData, and omit image.url.
- For a stable anonymous HTTPS image, build the single request body with:
``bash python3 scripts/buildeditplan.py \ --input-url '<public-target-image-url>' \ --width <width> \ --height <height> \ --adult-confirmed \ --rights-confirmed ``
Repeat --input-url for public bikini references. Use --swimsuit '<description>' when the user specifies a design. For a multi-person image, also pass --target-person '<unambiguous visual description>'.
- For a local file, probe
POST /gradio_api/upload through the same Monetize base URL before preparing payment. If the route returns Marketplace JSON 404, stop and request either a user-approved stable public HTTPS URL or a platform fix. Never upload directly to one upstream replica and reuse its local /tmp/gradio/... path through Monetize.
- If the proxy upload route becomes registered, upload the file through it and pass each returned server path with
--uploaded-path. Do not mix --input-url and --uploaded-path in one plan.
- Preserve the original aspect ratio. Use the source width and height when supported; do not silently crop or stretch.
- Show the generated cost summary and the residual ZeroGPU risk. Obtain approval for the maximum spend, with zero retries included.
- Follow the current FluxA Monetize integration guide and submit one final edit job. Keep wallet and x402 logic in the FluxA wallet integration, not in this skill.
- Save the full submission response, payment record, relevant proxy headers, and
eventid. An eventid proves only that the queue accepted the request.
- Read the validated free result stream and parse it with
scripts/parsesseresult.py. Require event: complete and at least one output image path or URL. Treat event: error, data: null, timeout, or a response with no image artifact as a technical failure.
- Download the result through the Monetize
/file=<path> route when the SSE includes image.path; the raw upstream *.hf.space URL can return 403. Save the result into a stable local file before presenting it.
- Count any successfully downloaded image as a successful generation, regardless of garment accuracy, identity drift, crop changes, background changes, or visual quality. Record those differences in the change report, but do not relabel the generation as failed and do not trigger an automatic retry.
- If a paid job returns no downloadable image, reconcile the mandate delta and transaction record, preserve an evidence bundle, mark an immediate provider or transport failure as a refund candidate, and stop. Do not claim a refund unless it is confirmed, and do not buy a retry without new approval even when the online guide recommends backoff.
- An optional direct-provider diagnostic may identify a proxy defect, but label it clearly and never present it as a successful Marketplace result.
Video input
Read [references/video-workflow.md](references/video-workflow.md). First refresh the live catalog for a true video-to-video editing endpoint that explicitly accepts a source video and preserves its motion. Do not substitute text-to-video or image-to-video and call it a preserved video edit.
When no verified video-edit endpoint exists, offer:
- a representative-frame preview: extract one frame and create one final image; or
- an experimental frame-by-frame edit: calculate the single-output price from the exact frame count, warn about temporal flicker, and proceed only after explicit approval.
Control the prompts
Use the single canonical template in [references/prompts.json](references/prompts.json). Keep prompt rewriting off by default so identity and scene constraints are not silently weakened. State explicitly that the output must remain a distinct two-piece bikini rather than athletic or one-piece swimwear.
Use a polished photorealistic finish. Permit restrained lighting polish and color grading while asking the model to preserve facial identity, hairstyle, body proportions, pose, framing, and background structure. Do not add logos, text, props, or new scenery.
Review for the change report
Compare the output with the source at original resolution. Record:
- face, expression, hair, skin tone, hands, body proportions, pose, and camera angle;
- background objects, geometry, framing, lighting direction, and shadows;
- complete removal of the original garment without leftover collars, sleeves, straps, or seams;
- a clearly distinct opaque two-piece bikini top and bottom with moderate coverage, plausible fabric, natural edges, and no accidental nudity;
- no one-piece conversion, rash guard, wetsuit, athletic bodysuit, swim shorts, or long sleeves unless the user explicitly requested them;
- no extra people, limbs, fingers, accessories, text, logos, or watermarks;
- for video, audio, duration, frame rate, motion continuity, and temporal clothing consistency.
Treat these observations as reporting fields, not pass/fail criteria. If the image downloaded successfully, keep the generation status successful and describe any deviation precisely. Offer a priced retry only when the user asks for one.
Deliver the result
Return:
Final Version as one local clickable file or rendered image.
Change Report covering garment replacement, permitted style changes, and every observed unavoidable drift.
Reusable Prompt and Parameters containing the exact prompt, seed, dimensions, steps, guidance scale, prompt-rewrite setting, input ordering, API slug, and paid-call count.
Cost and Status containing the approved amount, actual paid submissions, free result queries, failed attempts, and whether any retry remains unapproved.
Never claim success from an event_id alone. A completed and successfully downloaded image is a successful generation even when it does not follow the prompt well. Reserve failure status for cases where no image artifact can be downloaded, such as provider errors, transport errors, timeouts, or malformed completion responses.