Temuzin64 commited on
Commit
48c5df0
·
verified ·
1 Parent(s): 2d29e2d

Update script.js

Browse files
Files changed (1) hide show
  1. script.js +41 -15
script.js CHANGED
@@ -16,23 +16,49 @@ const modelLinks = ["https://api-inference.huggingface.co/models/Shakker-Labs/FL
16
 
17
 
18
  async function query(data) {
19
- const response = await fetch(
20
-
21
- modelLinks[2],
22
- // "https://api-inference.huggingface.co/models/glif/90s-anime-art",
23
- {
24
- headers: {
25
- Authorization: `Bearer ${token}`,
26
- "Content-Type": "application/json",
27
- },
28
- method: "POST",
29
- body: JSON.stringify(data),
30
- }
31
- );
32
- const result = await response.blob();
33
- return result;
34
  }
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  btn_clear_el.addEventListener("click", () => {
37
  promptText_el.value = "";
38
  });
 
16
 
17
 
18
  async function query(data) {
19
+ const response = await fetch(modelLinks[2], {
20
+ headers: {
21
+ Authorization: `Bearer ${token}`,
22
+ "Content-Type": "application/json",
23
+ },
24
+ method: "POST",
25
+ body: JSON.stringify(data),
26
+ });
27
+
28
+ if (!response.ok) {
29
+ const err = await response.text();
30
+ throw new Error(err);
31
+ }
32
+
33
+ return await response.blob();
34
  }
35
 
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+ // async function query(data) {
45
+ // const response = await fetch(
46
+
47
+ // modelLinks[2],
48
+ // // "https://api-inference.huggingface.co/models/glif/90s-anime-art",
49
+ // {
50
+ // headers: {
51
+ // Authorization: `Bearer ${token}`,
52
+ // "Content-Type": "application/json",
53
+ // },
54
+ // method: "POST",
55
+ // body: JSON.stringify(data),
56
+ // }
57
+ // );
58
+ // const result = await response.blob();
59
+ // return result;
60
+ // }
61
+
62
  btn_clear_el.addEventListener("click", () => {
63
  promptText_el.value = "";
64
  });