big update
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import { Setting } from '../store/Atoms'
|
||||
import { dataURItoBlob } from '../utils'
|
||||
|
||||
export const API_ENDPOINT = `${process.env.REACT_APP_INPAINTING_URL}/inpaint`
|
||||
export const API_ENDPOINT = `${process.env.REACT_APP_INPAINTING_URL}`
|
||||
|
||||
export default async function inpaint(
|
||||
imageFile: File,
|
||||
maskBase64: string,
|
||||
settings: Setting,
|
||||
sizeLimit?: string
|
||||
) {
|
||||
// 1080, 2000, Original
|
||||
@@ -13,13 +15,22 @@ export default async function inpaint(
|
||||
const mask = dataURItoBlob(maskBase64)
|
||||
fd.append('mask', mask)
|
||||
|
||||
fd.append('ldmSteps', settings.ldmSteps.toString())
|
||||
fd.append('hdStrategy', settings.hdStrategy)
|
||||
fd.append('hdStrategyCropMargin', settings.hdStrategyCropMargin.toString())
|
||||
fd.append(
|
||||
'hdStrategyCropTrigerSize',
|
||||
settings.hdStrategyCropTrigerSize.toString()
|
||||
)
|
||||
fd.append('hdStrategyResizeLimit', settings.hdStrategyResizeLimit.toString())
|
||||
|
||||
if (sizeLimit === undefined) {
|
||||
fd.append('sizeLimit', '1080')
|
||||
} else {
|
||||
fd.append('sizeLimit', sizeLimit)
|
||||
}
|
||||
|
||||
const res = await fetch(API_ENDPOINT, {
|
||||
const res = await fetch(`${API_ENDPOINT}/inpaint`, {
|
||||
method: 'POST',
|
||||
body: fd,
|
||||
}).then(async r => {
|
||||
@@ -28,3 +39,12 @@ export default async function inpaint(
|
||||
|
||||
return URL.createObjectURL(res)
|
||||
}
|
||||
|
||||
export function switchModel(name: string) {
|
||||
const fd = new FormData()
|
||||
fd.append('name', name)
|
||||
return fetch(`${API_ENDPOINT}/switch_model`, {
|
||||
method: 'POST',
|
||||
body: fd,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user