Dooratre commited on
Commit
336434a
·
verified ·
1 Parent(s): 242e5c3

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +43 -19
index.html CHANGED
@@ -1,19 +1,43 @@
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>API Interaction</title>
7
+ <script>
8
+ async function callAPI() {
9
+ const url = "https://huggingface.co/chat/conversation";
10
+ const headers = {
11
+ "Content-Type": "application/json",
12
+ "Cookie": "YOUR_COOKIE_HERE" // Replace with your actual cookie
13
+ };
14
+ const payload = {
15
+ "model": "nvidia/Llama-3.1-Nemotron-70B-Instruct-HF",
16
+ "preprompt": ""
17
+ };
18
+
19
+ try {
20
+ const response = await fetch(url, {
21
+ method: 'POST',
22
+ headers: headers,
23
+ body: JSON.stringify(payload)
24
+ });
25
+
26
+ if (response.ok) {
27
+ const data = await response.json();
28
+ document.getElementById("result").innerText = `ID: ${data.id}`; // Adjust based on actual response structure
29
+ } else {
30
+ document.getElementById("result").innerText = `Error: ${response.status}`;
31
+ }
32
+ } catch (error) {
33
+ document.getElementById("result").innerText = `Request failed: ${error.message}`;
34
+ }
35
+ }
36
+ </script>
37
+ </head>
38
+ <body>
39
+ <h1>API Interaction</h1>
40
+ <button onclick="callAPI()">Run API</button>
41
+ <p id="result"></p>
42
+ </body>
43
+ </html>