|
@@ -12,6 +12,11 @@
|
|
setStorage,
|
|
setStorage,
|
|
getStorage,
|
|
getStorage,
|
|
} from '@/utils/localStorage';
|
|
} from '@/utils/localStorage';
|
|
|
|
+ import Replicate from "replicate";
|
|
|
|
+
|
|
|
|
+ const replicate = new Replicate({
|
|
|
|
+ auth: "Token r8_VvWR3EJobLn1G4FNlyEqBZaXxWY4X4E3Yjyfy",
|
|
|
|
+ });
|
|
// import requestConfig from '@/static/lib/requestConfig';
|
|
// import requestConfig from '@/static/lib/requestConfig';
|
|
// const app = getApp(); //获取应用实例
|
|
// const app = getApp(); //获取应用实例
|
|
export default {
|
|
export default {
|
|
@@ -679,6 +684,90 @@
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ //直接调接口测试
|
|
|
|
+ async test() {
|
|
|
|
+ if(!this.styleList || this.curStyleIndex < 0 || !this.styleList[this.curStyleIndex].imgUrl){
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ if(this.$parent.pvCurPageName!="room_show"){//说明用户切换页面了
|
|
|
|
+ console.warn("***用户已经退出页面***")
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ const output = await replicate.run(
|
|
|
|
+ "batouresearch/sdxl-controlnet-lora:3bb13fe1c33c35987b33792b01b71ed6529d03f165d1c2416375859f09ca9fef",
|
|
|
|
+ {
|
|
|
|
+ input: {
|
|
|
|
+ seed: null,
|
|
|
|
+ image: "https://replicate.delivery/pbxt/JiOTMCHj4oGrTTf8Pg2r7vyI8YdXc5jL2IDyC2SfhuggjYe6/out-0%20(1).png",
|
|
|
|
+ prompt: "shot in the style of sksfer, a woman in alaska",
|
|
|
|
+ refine: "base_image_refiner",
|
|
|
|
+ strength: 0.8,
|
|
|
|
+ scheduler: "K_EULER",
|
|
|
|
+ lora_scale: 0.95,
|
|
|
|
+ num_outputs: 1,
|
|
|
|
+ lora_weights: "https://pbxt.replicate.delivery/mwN3AFyYZyouOB03Uhw8ubKW9rpqMgdtL9zYV9GF2WGDiwbE/trained_model.tar",
|
|
|
|
+ refine_steps: 20,
|
|
|
|
+ guidance_scale: 7.5,
|
|
|
|
+ apply_watermark: true,
|
|
|
|
+ condition_scale: 0.5,
|
|
|
|
+ negative_prompt: "",
|
|
|
|
+ num_inference_steps: 40
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ console.log(output);
|
|
|
|
+ // let imgUrl = this.styleList[this.curStyleIndex].imgUrl;
|
|
|
|
+ // let subType = this.subType;
|
|
|
|
+ // let session_hash = Date.now();
|
|
|
|
+ // let theme = this.themeList[this.themeIndex];//主题数据
|
|
|
|
+ // let prompt = this.styleList[this.curStyleIndex].prompt + theme.prot;
|
|
|
|
+ // let noPromot = this.styleList[this.curStyleIndex].negativePrompt;
|
|
|
|
+ // let unit = 768 / this.screenWidth;
|
|
|
|
+ // this.imageWidth = parseInt((this.screenWidth * unit).toFixed());
|
|
|
|
+ // this.imageHeight = parseInt((this.$parent.canvasHeight * unit).toFixed());
|
|
|
|
+ // this.timeOut = this.modelType==1 ? 20000: 120000;
|
|
|
|
+ // var parmas = {
|
|
|
|
+ // negativePrompt: noPromot,
|
|
|
|
+ // prompt: prompt,
|
|
|
|
+ // "batchSize": 1,
|
|
|
|
+ // brandId: $config.brandId,
|
|
|
|
+ // height: this.imageHeight,
|
|
|
|
+ // width: this.imageWidth,
|
|
|
|
+ // "moduleType": "AI_Biography",
|
|
|
|
+ // "steps":20,
|
|
|
|
+ // "sampler":"DDIM",
|
|
|
|
+ // "controlNetSessionHash":session_hash,
|
|
|
|
+ // "cfgScale":12,
|
|
|
|
+ // "denoising":0.9,
|
|
|
|
+ // image:this.shottingImg,
|
|
|
|
+ // styleImage:imgUrl,
|
|
|
|
+ // keyword: "replicate",
|
|
|
|
+ // model: this.modelType==1? "lucataco/ssd-1b" : 'catio-apps/controlnet-interior-design',
|
|
|
|
+ // };
|
|
|
|
+ // if(this.modelType==2){//精准设计
|
|
|
|
+ // if(subType == 0){//首次
|
|
|
|
+ // parmas.model = this.reqList[0].model;
|
|
|
|
+ // }else{//重试
|
|
|
|
+ // parmas.model = this.reqListReset[0].model;
|
|
|
|
+ // }
|
|
|
|
+ // }else{//创意设计
|
|
|
|
+ // if(subType == 0){//首次
|
|
|
|
+ // parmas.model = "lucataco/ssd-1b";
|
|
|
|
+ // }else{//重试
|
|
|
|
+ // parmas.model = "deployments/elabgroup/elab-ssd-1b";
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // this.curSpaceId = this.spaceObj.spaceId;//生成时的空间id
|
|
|
|
+ // // let result = await this.prevHandle(parmas);
|
|
|
|
+ // // console.warn("***prevHandle***",result)
|
|
|
|
+ // let res = await requestConfig("https://replicate.com/batouresearch/sdxl-controlnet-lora?input=nodejs", parmas);
|
|
|
|
+ // if (res && res.success) {
|
|
|
|
+
|
|
|
|
+ // }else{
|
|
|
|
+
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ },
|
|
//开始图生图流程
|
|
//开始图生图流程
|
|
async startServer() {
|
|
async startServer() {
|
|
if(!this.styleList || this.curStyleIndex < 0 || !this.styleList[this.curStyleIndex].imgUrl){
|
|
if(!this.styleList || this.curStyleIndex < 0 || !this.styleList[this.curStyleIndex].imgUrl){
|