ArtVentureX / sd-webui-agent-scheduler

620 stars 63 forks source link

May I ask how to return the image download direct link? #83

Closed Bruce337f closed 1 year ago

Bruce337f commented 1 year ago

In addition to the base64 encoding and zip compression package, the image data returned after the task is completed. Is there any way to directly return the link where the image can be downloaded?

Bruce337f commented 1 year ago

Instead of base64 encoding and decompressing the package to get the resulting image?

Thanks your work, it's good project!

artventuredev commented 1 year ago

@Bruce337f You can reuse the webui provided API for this. The file can be accessed via API /file={path/to/file} path. Eg:

http://sd-host.com:7680/file=outputs/text/00438-360778793.png

To get the file name, use the results field from the history API agent-scheduler/v1/history?limit=100&offset=0 response:

{
    "tasks": [
        {
            "id": "8bef48b3-eec0-4a16-8034-9dd4c4d7e5ec",
            "api_task_id": "f3cd65ad-bd83-4bef-937a-254f0e5d48f8",
            "api_task_callback": null,
            "name": null,
            "type": "txt2img",
            "status": "done",
            "params": {...},
            "priority": 1689919852502,
            "result": "{\"images\": [\"/home/ubuntu/automatic/outputs/text/00438-360778793.png\"], \"infotexts\": [...]}",
            "bookmarked": false,
            "created_at": 1689919852000,
            "updated_at": 1689919877000
        }
  ]
}
Bruce337f commented 1 year ago

Thanks for your reply, it's very useful for me! This is a great project! !