协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
ai-face-swap【开发与工程】Swap faces between photos realistically using each::sense AI. Transfer a face from one image onto another while preserving lighting, skin tone, and expression. Supports single and multi-face swaps with natural blending. Use for: entertainment, memes, movie poster parodies, cosplay previews, creative projects, social media content. Triggers: face swap…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Swap faces between photos with realistic blending and natural results using each::sense — the intelligent AI agent that automatically selects the best model for your request.
Requires an each::labs API key. Get one at eachlabs.ai.
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": "Swap the face from the first image onto the person in the second image. Keep the lighting, skin tone, and expression natural."},
{"type": "image_url", "image_url": {"url": "https://example.com/source-face.jpg"}},
{"type": "image_url", "image_url": {"url": "https://example.com/target-photo.jpg"}}
]
}
],
"stream": false
}'
from openai import OpenAI
client = OpenAI(
api_key="YOUR_EACHLABS_API_KEY",
base_url="https://eachsense-agent.core.eachlabs.run/v1"
)
response = client.chat.completions.create(
model="eachsense/beta",
messages=[{
"role": "user",
"content": "Swap the face from the first image onto the person in the second image. Keep the lighting, skin tone, and expression natural."
}],
# Images are included in the message content array above
)
print(response.choices[0].message.content)
Face swap requires reference images. Provide the source face and target photo via image_urls:
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [{"role": "user", "content": [
{"type": "text", "text": "Swap the face from image one onto the person in image two, matching the lighting and angle perfectly"},
{"type": "image_url", "image_url": {"url": "https://example.com/my-face.jpg"}},
{"type": "image_url", "image_url": {"url": "https://example.com/target-body.jpg"}}
]
}
],
"stream": false
}'
Images are sent inside messages using the OpenAI multimodal content format. Maximum 4 images per request.
Set "stream": true for real-time SSE responses, or "stream": false for complete result in a single response. Streaming is useful for showing progress in UIs; non-streaming is simpler for scripts and automation.
Always clarify which image is the source face and which is the target:
Swap the face from [image 1 description] onto [image 2 description]
Include quality instructions for better results:
Match the skin tone and lighting. Blend naturally around the jawline and hairline.
Preserve the original expression and head angle of the target.
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": "Take the face from the first photo and place it on the person in the second photo. The result should look like a natural portrait with proper skin tone matching and seamless blending around the edges."},
{"type": "image_url", "image_url": {"url": "https://example.com/person-a-headshot.jpg"}},
{"type": "image_url", "image_url": {"url": "https://example.com/person-b-portrait.jpg"}}
]
}
],
"stream": false
}'
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": "Swap my face from the first image onto the person wearing the medieval knight armor in the second image. Keep the armor and background unchanged, only replace the face."},
{"type": "image_url", "image_url": {"url": "https://example.com/my-selfie.jpg"}},
{"type": "image_url", "image_url": {"url": "https://example.com/knight-portrait.jpg"}}
]
}
],
"stream": false
}'
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": "In the group photo (second image), swap the face of the person on the far left with the face from the first image. Keep everyone else unchanged."},
{"type": "image_url", "image_url": {"url": "https://example.com/new-face.jpg"}},
{"type": "image_url", "image_url": {"url": "https://example.com/group-photo.jpg"}}
]
}
],
"stream": false
}'
# Step 1: Basic face swap
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": "Swap the face from image one onto the person in image two. Natural blending, match skin tone."},
{"type": "image_url", "image_url": {"url": "https://example.com/source.jpg"}},
{"type": "image_url", "image_url": {"url": "https://example.com/target.jpg"}}
]
}
],
"stream": false
}'
# Step 2: Refine if needed
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [
{
"role": "user",
"content": "Swap the face from image one onto the person in image two. Natural blending, match skin tone."
},
{
"role": "assistant",
"content": "..."
},
{
"role": "user",
"content": [
{"type": "text", "text": "Good result but the skin tone looks slightly off. Please adjust the skin tone to better match the target photo lighting and make the blend around the jawline smoother."},
{"type": "image_url", "image_url": {"url": "https://example.com/source.jpg"}},
{"type": "image_url", "image_url": {"url": "https://example.com/target.jpg"}}
]
}
],
"stream": false
}'