Enhance Your Creative Projects with Sakshamface Image Generation

In the world of digital artistry and content creation, the ability to generate images that align with your vision is crucial. Sakshamface offers a powerful Cognitive Action that allows developers to generate image predictions using advanced image processing techniques. This service simplifies the image creation process, enabling you to produce high-quality visuals quickly and efficiently. With options for inpainting, customizable aspect ratios, and model selections tailored for speed or detail, Sakshamface is a versatile tool for artists, designers, and developers alike.
Use Cases
Imagine needing a unique logo, a concept art piece, or visual content for a marketing campaign. Sakshamface can bring your ideas to life by generating images based on detailed prompts. Whether you are creating assets for a video game, designing promotional materials, or crafting personalized artwork, this tool helps streamline the creative process, allowing for rapid prototyping and iteration.
Prerequisites
To get started with Sakshamface, you'll need an API key for the Cognitive Actions service and a basic understanding of making API calls.
Generate Image Prediction
The Generate Image Prediction action is designed to create images based on user-defined prompts. It supports both image-to-image transformations and inpainting modes, making it a flexible solution for various creative needs.
Purpose: This action helps solve the problem of generating unique visuals by interpreting textual prompts and producing corresponding images. Users can customize their outputs significantly, choosing between different models that prioritize either speed or image quality.
Input Requirements: To utilize this action, you need to provide the following inputs:
- prompt (string): A detailed description of the image you want to generate.
- model (string): Choose between "dev" for detailed outputs or "schnell" for faster generation.
- aspectRatio (string): Defines the aspect ratio of the generated image.
- outputFormat (string): The format in which the image will be saved (webp, jpg, png).
- numberOfOutputs (integer): Specify how many images you want to generate (up to 4).
- Additional parameters like mask, width, height, guidanceScale, and others can fine-tune the output.
Expected Output: The action will return an array of URLs pointing to the generated images, allowing easy access to your creative work.
Example Input:
{
"model": "dev",
"prompt": "SAK: Generate a minimalist logo using the front view of my face. Focus exclusively on my beard and hairstyle, capturing their outline and unique shape in black. Remove all facial features (eyes, nose, mouth, etc.) and leave only the beard and hairstyle as clean, bold, black silhouettes. Ensure the design is simple, modern, and suitable for use as a personal logo.",
"aspectRatio": "1:1",
"outputFormat": "webp",
"guidanceScale": 3,
"numberOfOutputs": 4,
"outputImageQuality": 80
}
Example Output:
[
"https://assets.cognitiveactions.com/invocations/f02a7d18-898f-4e8d-bce2-72688af5c649/c59fcc83-10bf-401b-aeef-ec1eab27dcba.webp",
"https://assets.cognitiveactions.com/invocations/f02a7d18-898f-4e8d-bce2-72688af5c649/84272e4b-ab10-47ae-aec3-33f49e4d5ef5.webp",
"https://assets.cognitiveactions.com/invocations/f02a7d18-898f-4e8d-bce2-72688af5c649/3ab083d7-5d13-403b-8e59-cddae372e865.webp",
"https://assets.cognitiveactions.com/invocations/f02a7d18-898f-4e8d-bce2-72688af5c649/27c7fc8f-c4f5-4600-913c-0a955e13e67d.webp"
]
import requests
import json
# Replace with your actual Cognitive Actions API key and endpoint
# Ensure your environment securely handles the API key
COGNITIVE_ACTIONS_API_KEY = "YOUR_COGNITIVE_ACTIONS_API_KEY"
# This endpoint URL is hypothetical and should be documented for users
COGNITIVE_ACTIONS_EXECUTE_URL = "https://api.cognitiveactions.com/actions/execute"
action_id = "2194ca24-4b3e-4bc4-b587-9bf4c9f2bcd7" # Action ID for: Generate Image Prediction
# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
"model": "dev",
"prompt": "SAK: Generate a minimalist logo using the front view of my face. Focus exclusively on my beard and hairstyle, capturing their outline and unique shape in black. Remove all facial features (eyes, nose, mouth, etc.) and leave only the beard and hairstyle as clean, bold, black silhouettes. Ensure the design is simple, modern, and suitable for use as a personal logo. ",
"aspectRatio": "1:1",
"outputFormat": "webp",
"guidanceScale": 3,
"megapixelsCount": "1",
"numberOfOutputs": 4,
"outputImageQuality": 80,
"imagePromptStrength": 0.8,
"inferenceStepsCount": 28,
"loraWeightsIntensity": 1,
"fastGenerationEnabled": false,
"additionalLoraWeightsIntensity": 1
}
headers = {
"Authorization": f"Bearer {COGNITIVE_ACTIONS_API_KEY}",
"Content-Type": "application/json",
# Add any other required headers for the Cognitive Actions API
}
# Prepare the request body for the hypothetical execution endpoint
request_body = {
"action_id": action_id,
"inputs": payload
}
print(f"--- Calling Cognitive Action: {action.name or action_id} ---")
print(f"Endpoint: {COGNITIVE_ACTIONS_EXECUTE_URL}")
print(f"Action ID: {action_id}")
print("Payload being sent:")
print(json.dumps(request_body, indent=2))
print("------------------------------------------------")
try:
response = requests.post(
COGNITIVE_ACTIONS_EXECUTE_URL,
headers=headers,
json=request_body
)
response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)
result = response.json()
print("Action executed successfully. Result:")
print(json.dumps(result, indent=2))
except requests.exceptions.RequestException as e:
print(f"Error executing action {action_id}: {e}")
if e.response is not None:
print(f"Response status: {e.response.status_code}")
try:
print(f"Response body: {e.response.json()}")
except json.JSONDecodeError:
print(f"Response body (non-JSON): {e.response.text}")
print("------------------------------------------------")
Conclusion
Sakshamface's image generation capabilities empower developers to create tailored visuals that meet specific needs. By leveraging detailed prompts and customizable parameters, you can produce high-quality images quickly and efficiently. Whether for personal projects or professional applications, this Cognitive Action streamlines the creative process, making it easier than ever to bring your ideas to life. Start exploring the potential of Sakshamface today and elevate your creative endeavors!