ryesun's picture
initial
d757506
import request from '@/axios/axios';
import api from '@/axios/apiNames';
import axios from 'axios';
// 文本生成图片
export const getTxt2Img = (text: string) => {
let params = {
url: 'https://wef4y-stable-diffusion-webui-controlnet-docker.hf.space/sdapi/v1/txt2img',
data: {
prompt: '(8k, RAW photo, best quality, masterpiece:1.2), (realistic, photo-realistic:1.37),(Kpop idol), (aegyo sal:1), cute, professional lighting, photon mapping, radiosity, physically-based rendering, <lora:liyuuLora_liyuuV1:1>, standing,(simple white background:1.3),Fujifilm XT3,' + text,
enable_hr: false,
denoising_strength: 0.7,
firstphase_width: 0,
firstphase_height: 0,
hr_scale: 2,
hr_upscaler: "",
hr_second_pass_steps: 0,
hr_resize_x: 0,
hr_resize_y: 0,
styles: [],
seed: -1,
subseed: -1,
subseed_strength: 0,
seed_resize_from_h: -1,
seed_resize_from_w: -1,
sampler_name: "DPM++ SDE Karras",
batch_size: 1,
n_iter: 1,
steps: 24,
cfg_scale: 8.0,
width: 512,
height: 768,
restore_faces: false,
tiling: false,
negative_prompt: "paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glans, lowres,bad anatomy,bad hands, text, error, missing fingers,extra digit, fewer digits, cropped, worstquality, low quality, normal quality,jpegartifacts,signature, watermark, username,blurry,bad feet,cropped,poorly drawn hands,poorly drawn face,mutation,deformed,worst quality,low quality,normal quality,jpeg artifacts,signature,watermark,extra fingers,fewer digits,extra limbs,extra arms,extra legs,malformed limbs,fused fingers,too many fingers,long neck,cross-eyed,mutated hands,polar lowres,bad body,bad proportions,gross proportions,text,error,missing fingers,missing arms,missing legs,extra digit,wrinkle, NSFW, nude",
eta: 0,
s_churn: 0,
s_tmax: 0,
s_tmin: 0,
s_noise: 1,
override_settings: {},
override_settings_restore_afterwards: true,
script_args: [],
sampler_index: "DPM++ SDE Karras"
},
header: {
Authorization: 'Bearer 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'
}
}
// return axios.post('https://wef4y-stable-diffusion-webui-controlnet-docker.hf.space/sdapi/v1/txt2img', {})
return axios.post(params.url, params.data, {
timeout: 30000000,
headers: {
'Content-Type': 'application/json;charset=UTF-8',
'with-credentials': true,
...params.header
}
})
}
/**
* 对话数据
*/
export const getChatData = (input: string) => {
const params = {
url: 'https://wef4y-chat-js-server.hf.space/api/chat',
data: {
input
},
header: {
Authorization: 'Bearer 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'
}
}
return axios.post(params.url, params.data, {
timeout: 30000000,
headers: {
'Content-Type': 'application/json;charset=UTF-8',
'with-credentials': true,
...params.header
}
});
}