Create static/app.js
Browse files- static/app.js +7 -9
static/app.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
| 1 |
-
async function
|
| 2 |
-
|
| 3 |
-
let user = document.getElementById("user").value
|
| 4 |
-
let prompt = document.getElementById("prompt").value
|
| 5 |
|
| 6 |
let res = await fetch("/api/generate", {
|
| 7 |
-
method:"POST",
|
| 8 |
headers: {"Content-Type":"application/json"},
|
| 9 |
-
body: JSON.stringify({
|
| 10 |
-
})
|
| 11 |
|
| 12 |
-
let data = await res.json()
|
| 13 |
|
| 14 |
-
document.getElementById("
|
| 15 |
}
|
|
|
|
| 1 |
+
async function generate() {
|
| 2 |
+
let prompt = document.getElementById("prompt").value;
|
|
|
|
|
|
|
| 3 |
|
| 4 |
let res = await fetch("/api/generate", {
|
| 5 |
+
method: "POST",
|
| 6 |
headers: {"Content-Type":"application/json"},
|
| 7 |
+
body: JSON.stringify({prompt})
|
| 8 |
+
});
|
| 9 |
|
| 10 |
+
let data = await res.json();
|
| 11 |
|
| 12 |
+
document.getElementById("result").src = data.image;
|
| 13 |
}
|