Akjava commited on
Commit
d1393a5
1 Parent(s): b6e369d
Files changed (4) hide show
  1. index.html +27 -10
  2. index.js +0 -0
  3. index.pck +0 -0
  4. index.wasm +2 -2
index.html CHANGED
@@ -16,6 +16,7 @@
16
  <body>
17
 
18
  <canvas id="canvas"></canvas>
 
19
  <script src="ghugging.js"></script>
20
 
21
  <script type="module">
@@ -33,7 +34,8 @@
33
 
34
 
35
  // passing array seems ok others arraybuffer,unit8array faild
36
- Client.send_image_dict = async function(hf_token,prompt,dict,_js_callback){
 
37
  window.Buffer = ArrayBuffer
38
  if( hf_token == ""){
39
  console.log("send_dict1 without token")
@@ -62,10 +64,7 @@
62
  const file_ref2 = handle_file(blob2)
63
  console.log(file_ref2)
64
 
65
- //const url = " Akjava/SimpleStableDiffusionInpaint" //"https://d798497a30149f6f35.gradio.live/" // //"http://localhost:7861"
66
- const url = "Kwai-Kolors/Kolors-Inpainting"
67
- //const url = "Akjava/Kolors-Inpainting"
68
- //const url = "Akjava/SimpleStableDiffusionInpaint"
69
  const app = await Client.connect(url,{hf_token:hf_token,events: ["data","status"]});
70
  const app_info = app.view_api();
71
  console.log(app_info)
@@ -83,7 +82,23 @@
83
 
84
  //akjava
85
  //const submission = app.submit("/predict", {"prompt":prompt,"image1":file_ref1,"image2":file_ref2})
86
- const submission = app.submit("/infer", {"prompt":prompt,"image":{"background":file_ref1,"layers":[file_ref2]}})
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
 
88
 
89
  var result_url
@@ -108,8 +123,10 @@
108
 
109
  }
110
  }
111
- return submission
112
-
 
 
113
  };
114
 
115
  Client.test1 = async function(hf_token,test,_js_callback){
@@ -131,7 +148,7 @@
131
  const file_ref = handle_file(blob)
132
  console.log(file_ref)
133
 
134
- const url = "https://b0463e8c3c0ca3103e.gradio.live" //"http://localhost:7861"
135
  const app = await Client.connect(url)
136
  var result = await app.predict(
137
  "/predict",{"image1":file_ref} //send as tmp file?
@@ -190,7 +207,7 @@ return submission
190
 
191
  <script src="index.js"></script>
192
  <script>
193
- var engine = new Engine({"args":[],"canvasResizePolicy":2,"ensureCrossOriginIsolationHeaders":true,"executable":"index","experimentalVK":false,"fileSizes":{"index.pck":238256,"index.wasm":35372023},"focusCanvas":true,"gdextensionLibs":[]});
194
  engine.startGame();
195
  </script>
196
  </body>
 
16
  <body>
17
 
18
  <canvas id="canvas"></canvas>
19
+
20
  <script src="ghugging.js"></script>
21
 
22
  <script type="module">
 
34
 
35
 
36
  // passing array seems ok others arraybuffer,unit8array faild
37
+ Client.send_image_dict = async function(url,hf_token,prompt,dict,_js_callback){
38
+ try {
39
  window.Buffer = ArrayBuffer
40
  if( hf_token == ""){
41
  console.log("send_dict1 without token")
 
64
  const file_ref2 = handle_file(blob2)
65
  console.log(file_ref2)
66
 
67
+
 
 
 
68
  const app = await Client.connect(url,{hf_token:hf_token,events: ["data","status"]});
69
  const app_info = app.view_api();
70
  console.log(app_info)
 
82
 
83
  //akjava
84
  //const submission = app.submit("/predict", {"prompt":prompt,"image1":file_ref1,"image2":file_ref2})
85
+ console.log(url)
86
+ var parameter = {"image":{"background":file_ref1,"layers":[file_ref2]}}
87
+
88
+ var end_point = "/infer"
89
+
90
+ //NOT IN PAINT CASE NEED PROMPT
91
+ if( url!="Akjava/OpenCVInpaintCPU"){
92
+ parameter["prompt"] = prompt
93
+ if( url == "Akjava/flux1-schnell-img2img"){
94
+ end_point = "/process_images"
95
+ parameter["image"] = file_ref1
96
+ }
97
+ }
98
+
99
+
100
+ console.log(parameter)
101
+ const submission = app.submit(end_point, parameter)
102
 
103
 
104
  var result_url
 
123
 
124
  }
125
  }
126
+ }catch(error){
127
+ _js_callback(error.message)
128
+ }
129
+
130
  };
131
 
132
  Client.test1 = async function(hf_token,test,_js_callback){
 
148
  const file_ref = handle_file(blob)
149
  console.log(file_ref)
150
 
151
+ const url = "https://xxx.gradio.live" //"http://localhost:7861"
152
  const app = await Client.connect(url)
153
  var result = await app.predict(
154
  "/predict",{"image1":file_ref} //send as tmp file?
 
207
 
208
  <script src="index.js"></script>
209
  <script>
210
+ var engine = new Engine({"args":[],"canvasResizePolicy":2,"ensureCrossOriginIsolationHeaders":true,"executable":"index","experimentalVK":false,"fileSizes":{"index.pck":286816,"index.wasm":35376909},"focusCanvas":true,"gdextensionLibs":[]});
211
  engine.startGame();
212
  </script>
213
  </body>
index.js CHANGED
The diff for this file is too large to render. See raw diff
 
index.pck CHANGED
Binary files a/index.pck and b/index.pck differ
 
index.wasm CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:0cfd538cbf628a5626cd48db5e4ec7f883dcc22e1548b06fbe01b3450db316b9
3
- size 35372023
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fe5cebc590758c10bc4469be5a591e28edbde5ec8f458f21baeb83db50d028b9
3
+ size 35376909