PageSourceSearch

https://ai-creator.top/assets/index-7bb7710a.js

js ai-creator.top collected 2026-10-04 12:00:49 UTC 5,497 bytes, 6 lines download raw bytes

1import{j as e,r as d,H as z}from"./en-home-2f8e030b.js";import{a as w,c as h,T as I}from"./index-8d2e9e81.js";import{R as k,U as v}from"./index-72745927.js";import{f as D,a as N,g as b}from"./index-f6a6374c.js";import{R as M}from"./bundle-1382929a.js";import{t as S}from"./util-5ff8d215.js";import{d as T}from"./util-4d3641c7.js";import{M as C,a as R}from"./index-be0d86f1.js";import{P as U}from"./debounce-368eaac8.js";import"./EyeOutlined-ce991e25.js";import"./index-ca5ba0d8.js";const E="_dragWrapper_z18sm_1",G="_uploadDescription_z18sm_16",L="_uploadIcon_z18sm_19",B="_group_z18sm_23",H="_randomGroup_z18sm_28",P="_exampleImg_z18sm_35",F="_randomImgs_z18sm_45",$="_iconHand_z18sm_48",A="_titleShow_z18sm_51",m={dragWrapper:E,uploadDescription:G,uploadIcon:L,group:B,randomGroup:H,exampleImg:P,randomImgs:F,iconHand:$,titleShow:A},{Dragger:q}=v,O=s=>{const{onUploadEnd:a}=s,o={name:"file",accept:"image/*",customRequest:async({file:n})=>{const r=D(n),c=await N(r);a(r,c)},maxCount:1};return e.jsx(k,{children:n=>{const{bottom:r,top:c}=n,t=r-c;return e.jsxs("div",{className:m.dragWrapper,style:{height:t},children:[e.jsx("div",{className:m.titleShow,children:"图片转线稿"}),e.jsx("div",{className:m.group,children:e.jsxs(q,{...o,children:[e.jsx("p",{className:"ant-upload-drag-icon",children:e.jsx(w,{type:"icon-jingyingjihua",className:m.uploadIcon})}),e.jsx("p",{className:h("ant-upload-text",m.uploadDescription),children:"请上传图片,严禁上传公司数据或其他违禁文件"}),e.jsx("p",{className:h("ant-upload-hint",m.uploadDescription),children:"支持png、jpg、jpeg、bmp格式的图片,单张图片不超过5M"}),e.jsx("p",{className:h("ant-upload-hint",m.uploadDescription),children:"Line art processing sets the short edge to 768 px and rounds the other edge down to a multiple of 8. Processing time depends on your device and image shape."})]})})]})}})},J="_wrapper_rde9k_1",K="_wrapperBoundary_rde9k_4",Q="_progressWrapper_rde9k_10",V="_breathe_rde9k_1",X="_tips_rde9k_26",Y="_breath_rde9k_35",j={wrapper:J,wrapperBoundary:K,progressWrapper:Q,breathe:V,tips:X,breath:Y},Z="_innerWrapper_14984_1",ee="_wrapper_14984_4",te="_toolGroup_14984_9",oe="_toolWrapper_14984_20",ne="_downloadIcon_14984_27",ae="_downloadText_14984_30",se="_icon_14984_35",p={innerWrapper:Z,wrapper:ee,toolGroup:te,toolWrapper:oe,downloadIcon:ne,downloadText:ae,icon:se},re=window.ort;function ce(s,a){const[o,n,r]=[[],[],[]];for(let l=0;l<s.length;l+=4)o.push(s[l]),n.push(s[l+1]),r.push(s[l+2]);const c=o.concat(n).concat(r);let t=0;const u=c.length,i=new Float32Array(a[0]*a[1]*a[2]*a[3]);for(t=0;t<u;t++)i[t]=c[t]/255;return new re.Tensor("float32",i,a)}const x=768;function ie(s){return new Promise(a=>{const o=new Image;o.src=s,o.onload=async()=>{const n=document.createElement("canvas"),r=n.getContext("2d");let c=0,t=0;o.width<o.height?(c=x,t=Math.floor(x/o.width*o.height/8)*8):(t=x,c=Math.floor(x/o.height*o.width/8)*8),n.width=c,n.height=t,r.drawImage(o,0,0,c,t);const u=ce(r.getImageData(0,0,c,t).data,[1,3,t,c]);a(u)}})}function le(s){console.log(s,2222);const a=document.createElement("canvas"),o=a.getContext("2d");a.width=s.output.dims[3],a.height=s.output.dims[2];const n=s.output,r=S(n);for(let t=0;t<r.data.length;t=t+4)r.data[t]>150&&(r.data[t+1]=r.data[t],r.data[t+2]=r.data[t]);return o.putImageData(r,0,0),a.toDataURL()}const pe=()=>e.jsx("div",{
2    role:"status","aria-live":"polite","aria-atomic":true,"aria-busy":true,
3    "data-image-runtime-status":"processing",
4    style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",minHeight:"56px",textAlign:"center",lineHeight:1.6},
5    children:"模型处理中,请耐心等待"
6  }),de=()=>C.success({content:e.jsx(pe,{}),footer:null,icon:null,centered:!0,width:"220px",className:p.loadingModalWrapper});let y=null;const me=s=>{const{src:a,onClear:o=()=>{},worker:n,imageSize:r}=s,[c,t]=d.useState(a);return d.useEffect(()=>{n.onmessage=i=>{const{action:_}=i.data;if(_==="done"){console.log("11111",i.data);const l=i.data.result,g=le(l);t(g),y.destroy();return}},(async()=>{y=de();const i=await ie(a);n.postMessage({action:"run",inputTensor:i})})()},[a]),e.jsxs("div",{className:p.wrapper,children:[e.jsx("div",{className:p.innerWrapper,style:{width:`${b(r)}px`},children:e.jsx(M,{leftImage:a,rightImage:c})}),e.jsx("div",{className:p.toolGroup,children:e.jsxs("div",{className:p.toolWrapper,children:[e.jsx(I,{placement:"topLeft",title:"下载",children:e.jsx(w,{className:h(p.downloadIcon,p.icon),type:"icon-xiazai1",onClick:async()=>{T(c,`line-art_${+new Date}`)}})}),e.jsx(I,{placement:"topLeft",title:"重传",children:e.jsx(w,{className:h(p.downloadIcon,p.icon),type:"icon-zhongxinkaishi",onClick:o})})]})})]})},ue=()=>new Worker(new URL("/assets/linechange.worker-0b3909b2.js",self.location)),ke=s=>{const{history:a}
6=s,[o,n]=d.useState(""),[r,c]=d.useState([0,0]),[t,u]=d.useState(!1),i=d.useMemo(()=>ue(),[]);d.useEffect(()=>{window.document.oncontextmenu=()=>!1,(async()=>{i.onmessage=g=>{const{action:W}=g.data;if(W=="loadComplete"){u(!0);const f=document.getElementById("progressWrapper");f&&(f.style.display="none")}}})(),i.postMessage({action:"init"})},[]);const _=()=>t?o?e.jsx(me,{src:o,worker:i,imageSize:r,onClear:()=>{n("")}}):e.jsx(O,{onUploadEnd:(l,g)=>{n(l),c(g)}}):e.jsx("div",{className:j.wrapperBoundary,children:e.jsx(R,{})});return e.jsxs("div",{className:j.wrapper,children:[e.jsx(z,{title:"AI 线稿转化",history:a}),_()]})};export{ke as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.