ZeroGravityYz commited on
Commit
719a9b0
·
1 Parent(s): aed8fda

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +77 -17
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>Hugging Face Chatbot</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ background-color: #f5f5f5;
11
+ display: flex;
12
+ justify-content: center;
13
+ align-items: center;
14
+ height: 100vh;
15
+ margin: 0;
16
+ }
17
+ .chat-container {
18
+ background-color: #ffffff;
19
+ border-radius: 5px;
20
+ box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
21
+ width: 80%;
22
+ max-width: 500px;
23
+ padding: 20px;
24
+ }
25
+ input[type="text"] {
26
+ border: 1px solid #cccccc;
27
+ border-radius: 3px;
28
+ padding: 10px;
29
+ width: 100%;
30
+ box-sizing: border-box;
31
+ margin-bottom: 10px;
32
+ }
33
+ button {
34
+ background-color: #007bff;
35
+ border: none;
36
+ border-radius: 3px;
37
+ color: #ffffff;
38
+ cursor: pointer;
39
+ padding: 10px;
40
+ width: 100%;
41
+ }
42
+ .response {
43
+ margin-top: 20px;
44
+ }
45
+ </style>
46
+ </head>
47
+ <body>
48
+ <div class="chat-container">
49
+ <input type="text" id="user-input" placeholder="Type your message" />
50
+ <button id="submit">Send</button>
51
+ <div class="response" id="response"></div>
52
+ </div>
53
+
54
+ <script>
55
+ async function query(data) {
56
+ const response = await fetch(
57
+ "https://api-inference.huggingface.co/models/decapoda-research/llama-7b-hf",
58
+ {
59
+ headers: { Authorization: "Bearer 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" },
60
+ method: "POST",
61
+ body: JSON.stringify(data),
62
+ }
63
+ );
64
+ const result = await response.json();
65
+ return result;
66
+ }
67
+
68
+ document.getElementById("submit").addEventListener("click", async () => {
69
+ const userInput = document.getElementById("user-input").value;
70
+ const responseContainer = document.getElementById("response");
71
+
72
+ if (userInput) {
73
+ const response = await query({ "inputs": userInput });
74
+ responseContainer.innerHTML = response.generated_text;
75
+ }
76
+ });
77
+ </script>
78
+ </body>
79
  </html>