yukiarimo commited on
Commit
6fc09f0
1 Parent(s): 9f39652

Create templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +29 -0
templates/index.html ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>AI App Demo</title>
5
+ </head>
6
+ <body>
7
+ <h1>AI App Demo</h1>
8
+ <input type="text" id="userInput" placeholder="Enter your message">
9
+ <button onclick="sendMessage()">Send</button>
10
+ <div id="response"></div>
11
+
12
+ <script>
13
+ function sendMessage() {
14
+ const userInput = document.getElementById('userInput').value;
15
+ fetch('/api/generate', {
16
+ method: 'POST',
17
+ headers: {
18
+ 'Content-Type': 'application/json'
19
+ },
20
+ body: JSON.stringify({ message: userInput })
21
+ })
22
+ .then(response => response.json())
23
+ .then(data => {
24
+ document.getElementById('response').innerHTML = data.response;
25
+ });
26
+ }
27
+ </script>
28
+ </body>
29
+ </html>