Update index.html
Browse files- index.html +43 -19
index.html
CHANGED
@@ -1,19 +1,43 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>
|