Spaces:
Running
Running
| title: Image Inversion | |
| emoji: 👀 | |
| colorFrom: red | |
| colorTo: red | |
| sdk: gradio | |
| sdk_version: 5.29.0 | |
| app_file: app.py | |
| pinned: false | |
| license: mit | |
| short_description: Reverse tag generation based on uploaded anime images | |
| hf_oauth: true | |
| Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference | |
| ## 自定义任务 API | |
| 该 Space 在保留原 Gradio 页面功能的同时提供受共享密钥保护的异步标签分析接口: | |
| - `POST /api/jobs`:创建任务,返回 `job_id`、`status_url` 与 `poll_after_seconds`。 | |
| - `GET /api/jobs/{job_id}`:运行中返回 HTTP 202;成功返回标签展示字段;失败返回脱敏错误码。 | |
| - 两个接口都必须携带 `X-API-Key`。创建接口支持最长 200 字符的 `Idempotency-Key`。 | |
| 创建请求 JSON: | |
| ```json | |
| { | |
| "input_image_url": "https://example.com/input.png", | |
| "general_threshold": 0.35, | |
| "character_threshold": 0.85, | |
| "show_confidence": true, | |
| "show_general": true, | |
| "show_character": true, | |
| "show_ip": true, | |
| "separator": "comma", | |
| "show_chinese": true | |
| } | |
| ``` | |
| `separator` 仅接受 `comma`、`newline` 或 `space`。远程图片仅允许来自 `JOB_IMAGE_ALLOWED_HOSTS` 配置的精确 HTTPS 主机。 | |
| 部署时必须设置: | |
| - Secret:`JOB_API_KEY`(至少 32 字符)。 | |
| - Variable:`JOB_IMAGE_ALLOWED_HOSTS`(逗号分隔的精确域名,不支持通配符)。 | |
| 可选 Variables:`JOB_RESULT_TTL_SECONDS`、`JOB_POLL_AFTER_SECONDS`、`JOB_IMAGE_FETCH_TIMEOUT_SECONDS`、`JOB_IMAGE_MAX_BYTES`、`JOB_IMAGE_MAX_PIXELS`、`JOB_IMAGE_MAX_DIMENSION`、`JOB_MAX_RECORDS`、`SPACE_HOST`。 | |