Enhance Your Images with Supir V0f's Advanced Quality Restoration

25 Apr 2025
Enhance Your Images with Supir V0f's Advanced Quality Restoration

In the world of digital media, image quality can significantly impact user experience, brand perception, and overall engagement. Supir V0f offers powerful Cognitive Actions focused on enhancing photo-realistic image quality, allowing developers to effortlessly restore and elevate the quality of images that may be lightly degraded. By leveraging advanced prompts for restoration, this service ensures that crucial details are retained, resulting in stunning visuals without the need for complex models.

Whether you're working on applications involving photography, e-commerce, or social media, the ability to enhance images quickly and effectively can save time and improve the quality of your content. Imagine a scenario where you have a batch of low-quality images that need to be polished before a marketing campaign. Using Supir V0f, you can automate the enhancement process, ensuring consistent and high-quality results across all visuals.

Prerequisites

To get started with Supir V0f, you will need a Cognitive Actions API key and a basic understanding of making API calls.

Enhance Photo-Realistic Image Quality

The primary action of Supir V0f is designed to improve the quality of images while retaining their original details. This action is particularly beneficial for applications that require high-quality visuals but may be dealing with images that are not up to par.

Purpose

This action utilizes the SUPIR-v0F model to enhance images by restoring photo-realistic features effectively, which helps in situations where images might have suffered from slight degradation.

Input Requirements

The input for this action requires a low-quality image URI, along with several optional parameters to customize the enhancement process:

  • image: The URI of the low-quality input image (required).
  • seed: An optional integer for initializing the random number generator.
  • upscale: An optional integer defining the upsampling ratio (default is 1).
  • additivePrompt: A string to enhance the image quality with positive features.
  • negativePrompt: A string listing features to avoid in the output.
  • edmSamplingSteps: Number of sampling steps to execute (default is 50).
  • Additional parameters for color correction, resolution, and control strength.

Expected Output

The output will be a URI link to the enhanced image, showcasing improved quality while preserving the integrity of the original content.

Use Cases for this specific action

  • E-commerce: Restore product images to make them more appealing to potential customers.
  • Photography: Enhance personal or professional photography collections for portfolios or galleries.
  • Social Media: Improve the quality of images before sharing them on platforms, ensuring a professional look.
  • Content Creation: Assist content creators in producing high-quality visuals for blogs, videos, or presentations.
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 = "da48d3d5-429c-4d8d-b702-f72bc8f979f1" # Action ID for: Enhance Photo-Realistic Image Quality

# Construct the exact input payload based on the action's requirements
# This example uses the predefined example_input for this action:
payload = {
  "image": "https://replicate.delivery/pbxt/KSGCHApvib6EmVBpjerLhsht3UU2YAI9GkV87kWVp5wAT98T/07.png",
  "upscale": 1,
  "additivePrompt": "Cinematic, High Contrast, highly detailed, taken using a Canon EOS R camera, hyper detailed photo - realistic maximum detail, 32k, Color Grading, ultra HD, extreme meticulous detailing, skin pore detailing, hyper sharpness, perfect without deformations.",
  "negativePrompt": "painting, oil painting, illustration, drawing, art, sketch, oil painting, cartoon, CG Style, 3D render, unreal engine, blurring, dirty, messy, worst quality, low quality, frames, watermark, signature, jpeg artifacts, deformed, lowres, over-smooth",
  "edmSamplingSteps": 50,
  "linearCfgIncrease": false,
  "minimumResolution": 1024,
  "colorCorrectionType": "Wavelet",
  "startPointLinearCfg": 1,
  "controlStrengthStage1": -1,
  "controlStrengthStage2": 1,
  "originalChurnParameter": 5,
  "originalNoiseParameter": 1.003,
  "classifierFreeGuidanceScale": 7.5,
  "linearControlStrengthStage2": false,
  "startPointLinearControlStrengthStage2": 0
}

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

Supir V0f provides developers with a robust solution for enhancing image quality, making it an invaluable tool for various applications. By utilizing advanced restoration techniques, you can achieve professional-grade visuals with minimal effort. Whether you're enhancing images for marketing, social media, or personal projects, this action simplifies the process while ensuring high-quality output.

Explore the possibilities with Supir V0f and take your image enhancement capabilities to the next level!