Spaces:
Runtime error
Runtime error
Ron Au
commited on
Commit
•
0731409
1
Parent(s):
7d3f7e9
Initial Commit
Browse files
index.js
CHANGED
@@ -1,26 +1,26 @@
|
|
1 |
-
if (document.location.search.includes(
|
2 |
-
document.body.classList.add(
|
3 |
}
|
4 |
|
5 |
const textToImage = async (text) => {
|
6 |
-
const inferenceResponse = await fetch(
|
7 |
const inferenceBlob = await inferenceResponse.blob();
|
8 |
|
9 |
return URL.createObjectURL(inferenceBlob);
|
10 |
};
|
11 |
|
12 |
const translateText = async (text) => {
|
13 |
-
const inferResponse = await fetch(
|
14 |
const inferJson = await inferResponse.json();
|
15 |
|
16 |
return inferJson.output;
|
17 |
};
|
18 |
|
19 |
-
const imageGenSelect = document.getElementById(
|
20 |
-
const imageGenImage = document.querySelector(
|
21 |
-
const textGenForm = document.querySelector(
|
22 |
|
23 |
-
imageGenSelect.addEventListener(
|
24 |
const value = event.target.value;
|
25 |
|
26 |
try {
|
@@ -30,11 +30,11 @@ imageGenSelect.addEventListener('change', async (event) => {
|
|
30 |
}
|
31 |
});
|
32 |
|
33 |
-
textGenForm.addEventListener(
|
34 |
event.preventDefault();
|
35 |
|
36 |
-
const textGenInput = document.getElementById(
|
37 |
-
const textGenParagraph = document.querySelector(
|
38 |
|
39 |
try {
|
40 |
textGenParagraph.textContent = await translateText(textGenInput.value);
|
|
|
1 |
+
if (document.location.search.includes("dark-theme=true")) {
|
2 |
+
document.body.classList.add("dark-theme");
|
3 |
}
|
4 |
|
5 |
const textToImage = async (text) => {
|
6 |
+
const inferenceResponse = await fetch(`biggan_infer?input=${text}`);
|
7 |
const inferenceBlob = await inferenceResponse.blob();
|
8 |
|
9 |
return URL.createObjectURL(inferenceBlob);
|
10 |
};
|
11 |
|
12 |
const translateText = async (text) => {
|
13 |
+
const inferResponse = await fetch(`t5_infer?input=${text}`);
|
14 |
const inferJson = await inferResponse.json();
|
15 |
|
16 |
return inferJson.output;
|
17 |
};
|
18 |
|
19 |
+
const imageGenSelect = document.getElementById("image-gen-input");
|
20 |
+
const imageGenImage = document.querySelector(".image-gen-output");
|
21 |
+
const textGenForm = document.querySelector(".text-gen-form");
|
22 |
|
23 |
+
imageGenSelect.addEventListener("change", async (event) => {
|
24 |
const value = event.target.value;
|
25 |
|
26 |
try {
|
|
|
30 |
}
|
31 |
});
|
32 |
|
33 |
+
textGenForm.addEventListener("submit", async (event) => {
|
34 |
event.preventDefault();
|
35 |
|
36 |
+
const textGenInput = document.getElementById("text-gen-input");
|
37 |
+
const textGenParagraph = document.querySelector(".text-gen-output");
|
38 |
|
39 |
try {
|
40 |
textGenParagraph.textContent = await translateText(textGenInput.value);
|