This commit is contained in:
wq.chu
2021-11-15 15:22:34 +08:00
commit 4e027f81e6
44 changed files with 14458 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
import { dataURItoBlob } from '../utils'
export const API_ENDPOINT = `${process.env.REACT_APP_INPAINTING_URL}/inpaint`
export default async function inpaint(imageFile: File, maskBase64: string) {
const fd = new FormData()
fd.append('image', imageFile)
const mask = dataURItoBlob(maskBase64)
fd.append('mask', mask)
const res = await fetch(API_ENDPOINT, {
method: 'POST',
body: fd,
}).then(async r => {
return r.blob()
})
return URL.createObjectURL(res)
}