Spaces:
Running
Running
Update script.js
Browse files
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 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
return
|
| 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 |
});
|