{
 "openapi": "3.0.3",
 "info": {
  "title": "Face restoration (default): CodeFormer",
  "version": "2026-11-21",
  "description": "Curated ZeroGPU tool from the ZeroGPU lineup catalog. Calls go straight to the upstream Space sczhou/CodeFormer; send your own HF token as a bearer token so the call uses your ZeroGPU quota."
 },
 "servers": [
  {
   "url": "https://sczhou-codeformer.hf.space"
  }
 ],
 "x-zerogpu": {
  "category": "Image utilities and perception",
  "slot": "Face restoration",
  "need": "Repair faces in old, compressed or generated images.",
  "role": "default",
  "space": "sczhou/CodeFormer",
  "space_url": "https://huggingface.co/spaces/sczhou/CodeFormer",
  "model": "CodeFormer",
  "license": "S-Lab License (non-commercial)",
  "license_class": "nc",
  "gpu_seconds_booked": "60",
  "notes": "Still the reference face restorer, and very popular.",
  "caveats": "",
  "lineup_call": "/inference(image, face_align, background_enhance, face_upsample, upscale=2, codeformer_fidelity=0.5) \u2192 image",
  "api_style": "v1"
 },
 "components": {
  "securitySchemes": {
   "hfToken": {
    "type": "http",
    "scheme": "bearer",
    "description": "Your own Hugging Face token (read scope is enough). It is sent only to the upstream Space and bills that call to your account's ZeroGPU quota. Without it the call runs on the small anonymous quota."
   }
  },
  "schemas": {}
 },
 "paths": {
  "/gradio_api/call/inference": {
   "post": {
    "description": "Repair faces in old, compressed or generated images. Step 1 of 2: returns {\"event_id\"}; then GET /gradio_api/call/inference/{event_id} reads an SSE stream whose `event: complete` data is the JSON output array (`event: error` on failure). Upstream: https://huggingface.co/spaces/sczhou/CodeFormer. License: S-Lab License (non-commercial). \n\nUpstream description: Run a single prediction on the model\nReturns, in order: Output: dict(path: str | None (Path to a local file), url: str | None (Publicly available url or base64 encoded image), size: int | None (Size of image in bytes), orig_name: str | None (Original filename), mime_type: str | None (mime type of image), is_stream: bool (Can always be set to False), meta: dict(str, Any)); value_15: str",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "data"
        ],
        "properties": {
         "data": {
          "type": "array",
          "minItems": 1,
          "maxItems": 6,
          "items": {},
          "description": "Positional inputs, in this order:\n0. image: dict(path: str | None (Path to a local file), url: str | None (Publicly available url or base64 encoded image), size: int | None (Size of image in bytes), orig_name: str | None (Original filename), mime_type: str | None (mime type of image), is_stream: bool (Can always be set to False), meta: dict(str, Any)) (required)\n1. face_align: bool (default true)\n2. background_enhance: bool (default true)\n3. face_upsample: bool (default true)\n4. upscale: float (default 2)\n5. codeformer_fidelity: float (default 0.5)"
         }
        }
       }
      }
     }
    },
    "x-gradio-parameters": [
     {
      "name": "image",
      "schema": {
       "type": "object",
       "required": [
        "path",
        "meta"
       ],
       "description": "A file. Set path to a public https URL (or a path returned by POST /gradio_api/upload on the same Space) and meta to {\"_type\": \"gradio.FileData\"}.",
       "properties": {
        "path": {
         "type": "string"
        },
        "url": {
         "type": "string"
        },
        "orig_name": {
         "type": "string"
        },
        "meta": {
         "type": "object",
         "properties": {
          "_type": {
           "type": "string",
           "enum": [
            "gradio.FileData"
           ]
          }
         }
        }
       }
      },
      "required": true,
      "default": null
     },
     {
      "name": "face_align",
      "schema": {
       "type": "boolean"
      },
      "required": false,
      "default": true
     },
     {
      "name": "background_enhance",
      "schema": {
       "type": "boolean"
      },
      "required": false,
      "default": true
     },
     {
      "name": "face_upsample",
      "schema": {
       "type": "boolean"
      },
      "required": false,
      "default": true
     },
     {
      "name": "upscale",
      "schema": {
       "type": "number"
      },
      "required": false,
      "default": 2
     },
     {
      "name": "codeformer_fidelity",
      "schema": {
       "type": "number",
       "description": "numeric value between 0 and 1"
      },
      "required": false,
      "default": 0.5
     }
    ],
    "operationId": "image_utils_face_restoration",
    "tags": [
     "Image utilities and perception"
    ],
    "security": [
     {
      "hfToken": []
     },
     {}
    ],
    "summary": "Face restoration (default): CodeFormer",
    "responses": {
     "200": {
      "description": "Job accepted.",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "event_id"
         ],
         "properties": {
          "event_id": {
           "type": "string"
          }
         }
        }
       }
      }
     }
    }
   }
  },
  "/gradio_api/call/inference/{event_id}": {
   "get": {
    "summary": "Read the result stream for /inference",
    "description": "Server-sent events. The final `event: complete` carries a JSON array of outputs; `event: error` means the call failed.",
    "parameters": [
     {
      "name": "event_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "SSE stream",
      "content": {
       "text/event-stream": {
        "schema": {
         "type": "string"
        }
       }
      }
     }
    },
    "operationId": "image_utils_face_restoration_result",
    "tags": [
     "Image utilities and perception"
    ],
    "security": [
     {
      "hfToken": []
     },
     {}
    ]
   }
  }
 }
}