Image compare widget

This commit is contained in:
space-nuko
2023-05-11 00:14:25 -05:00
parent 0013833b16
commit bc4128f07a
8 changed files with 242 additions and 1 deletions

View File

@@ -123,7 +123,6 @@ export const debounce = (callback: Function, wait = 250) => {
export function convertComfyOutputToGradio(output: GalleryOutput): GradioFileData[] {
return output.images.map(r => {
// TODO configure backend URL
const url = `http://${location.hostname}:8188` // TODO make configurable
const params = new URLSearchParams(r)
const fileData: GradioFileData = {
@@ -136,6 +135,18 @@ export function convertComfyOutputToGradio(output: GalleryOutput): GradioFileDat
});
}
export function convertFilenameToComfyURL(filename: string,
subfolder: string = "",
type: "input" | "output" | "temp" = "output"): string {
const params = new URLSearchParams({
filename,
subfolder,
type
})
const url = `http://${location.hostname}:8188` // TODO make configurable
return url + "/view?" + params
}
export function jsonToJsObject(json: string): string {
// Try to parse, to see if it's real JSON
JSON.parse(json);