ProCreations commited on
Commit
afde003
·
1 Parent(s): 8c33c2b
Files changed (1) hide show
  1. index.html +78 -18
index.html CHANGED
@@ -1,19 +1,79 @@
1
  <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Simple Chat App</title>
7
+ <style>
8
+ body {
9
+ font-family: 'Arial', sans-serif;
10
+ background-color: #f4f4f4;
11
+ margin: 0;
12
+ padding: 20px;
13
+ text-align: center;
14
+ }
15
+
16
+ #chat-container {
17
+ max-width: 400px;
18
+ margin: auto;
19
+ background-color: #fff;
20
+ padding: 20px;
21
+ border-radius: 8px;
22
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
23
+ }
24
+
25
+ input {
26
+ width: 80%;
27
+ padding: 8px;
28
+ margin: 10px 0;
29
+ box-sizing: border-box;
30
+ }
31
+
32
+ button {
33
+ width: 80%;
34
+ padding: 10px;
35
+ background-color: #3498db;
36
+ color: #fff;
37
+ border: none;
38
+ border-radius: 4px;
39
+ cursor: pointer;
40
+ }
41
+
42
+ #chat-output {
43
+ text-align: left;
44
+ margin-top: 20px;
45
+ }
46
+ </style>
47
+ </head>
48
+ <body>
49
+ <div id="chat-container">
50
+ <h2>Simple Chat App</h2>
51
+ <input type="text" id="user-input" placeholder="Type your message...">
52
+ <button onclick="sendMessage()">Send</button>
53
+ <div id="chat-output"></div>
54
+ </div>
55
+
56
+ <script>
57
+ function sendMessage() {
58
+ const userInput = document.getElementById('user-input').value;
59
+ const chatOutput = document.getElementById('chat-output');
60
+
61
+ // Make a simple fetch request to the chat API
62
+ fetch('https://pro-ai.glitch.me/api-chat', {
63
+ method: 'POST',
64
+ headers: {
65
+ 'Content-Type': 'application/json',
66
+ },
67
+ body: JSON.stringify({ input: userInput }),
68
+ })
69
+ .then(response => response.json())
70
+ .then(data => {
71
+ // Display the response in the chat output
72
+ chatOutput.innerHTML += `<p><strong>User:</strong> ${userInput}</p>`;
73
+ chatOutput.innerHTML += `<p><strong>AI:</strong> ${data.response}</p>`;
74
+ })
75
+ .catch(error => console.error('Error:', error));
76
+ }
77
+ </script>
78
+ </body>
79
+ </html>