Akoda35 commited on
Commit
05d7a6f
·
verified ·
1 Parent(s): 925ff5c

Create frontend/app.js

Browse files
Files changed (1) hide show
  1. frontend/app.js +18 -0
frontend/app.js ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ async function submitRequest() {
2
+
3
+ const prompt = document.getElementById("prompt").value;
4
+
5
+ const response = await fetch("/generate", {
6
+ method: "POST",
7
+ headers: {
8
+ "Content-Type": "application/json"
9
+ },
10
+ body: JSON.stringify({ prompt })
11
+ });
12
+
13
+ const data = await response.json();
14
+
15
+ document.getElementById("results").innerHTML = `
16
+ <pre>${JSON.stringify(data, null, 2)}</pre>
17
+ `;
18
+ }