YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

InfiniteYou-HF - Hugging Face Inference Endpoint

This repository contains the InfiniteYou model adapted for Hugging Face Inference Endpoints, focusing on character generation with identity preservation.

Usage

Authentication

This endpoint requires token-based authentication. Include your Hugging Face token in the Authorization header.

Example Usage

import requests
import base64

# Load your image
with open("person.jpg", "rb") as f:
    id_image_b64 = base64.b64encode(f.read()).decode()

# Call endpoint
response = requests.post(
    "https://YOUR-ENDPOINT.endpoints.huggingface.cloud",
    headers={"Authorization": "Bearer YOUR_HF_TOKEN"},
    json={
        "inputs": {
            "prompt": "A sophisticated gentleman in a business suit",
            "id_image": f"data:image/jpeg;base64,{id_image_b64}",
            "seed": 42,
            "width": 864,
            "height": 1152,
            "guidance_scale": 3.5,
            "num_steps": 30,
            "enable_realism": True,
            "enable_anti_blur": False,
            "model_version": "aes_stage2"
        }
    }
)

# Get the generated image
if response.status_code == 200:
    result = response.json()
    if result.get("success"):
        # Decode base64 image
        import base64
        from PIL import Image
        import io
        
        image_data = base64.b64decode(result["image"])
        image = Image.open(io.BytesIO(image_data))
        image.save("generated_image.png")
        print("Image saved as generated_image.png")
    else:
        print(f"Error: {result.get('error')}")
else:
    print(f"Request failed with status {response.status_code}")

Parameters

  • prompt (required): Text description of the desired image
  • id_image (required): Base64-encoded image of the person whose identity to preserve
  • seed (optional): Random seed for reproducible results (default: 0 for random)
  • width (optional): Output image width (default: 864)
  • height (optional): Output image height (default: 1152)
  • guidance_scale (optional): Guidance scale for generation (default: 3.5)
  • num_steps (optional): Number of inference steps (default: 30)
  • enable_realism (optional): Enable realism LoRA (default: True)
  • enable_anti_blur (optional): Enable anti-blur LoRA (default: False)
  • model_version (optional): Model version to use - "sim_stage1" or "aes_stage2" (default: "aes_stage2")

Setup

  1. Run download_models.py locally to download all required models
  2. Install Git LFS: git lfs install
  3. Push the entire repository to Hugging Face
  4. Deploy as an Inference Endpoint from the Hugging Face UI

Model Requirements

The following models are required and will be downloaded by download_models.py:

  • ByteDance/InfiniteYou
  • black-forest-labs/FLUX.1-schnell
  • Custom LoRAs for enhanced realism
Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support