Update index.html
Browse files- index.html +59 -18
index.html
CHANGED
@@ -1,19 +1,60 @@
|
|
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>
|
3 |
+
<head>
|
4 |
+
<meta charset="utf-8" />
|
5 |
+
<meta name="viewport" content="width=device-width" />
|
6 |
+
<title>OpenBuddy Text Generation</title>
|
7 |
+
<link rel="stylesheet" href="style.css" />
|
8 |
+
</head>
|
9 |
+
<body>
|
10 |
+
<div class="container">
|
11 |
+
<h1>OpenBuddy Text Generation</h1>
|
12 |
+
<form id="generateForm">
|
13 |
+
<div class="form-group">
|
14 |
+
<label for="promptInput">Enter your prompt:</label>
|
15 |
+
<textarea id="promptInput" rows="5" cols="50" required></textarea>
|
16 |
+
</div>
|
17 |
+
<button type="submit">Generate Text</button>
|
18 |
+
</form>
|
19 |
+
<div id="resultContainer" style="display: none;">
|
20 |
+
<h2>Generated Text:</h2>
|
21 |
+
<p id="generatedText"></p>
|
22 |
+
</div>
|
23 |
+
</div>
|
24 |
+
|
25 |
+
<script>
|
26 |
+
document.getElementById('generateForm').addEventListener('submit', function(e) {
|
27 |
+
e.preventDefault();
|
28 |
+
const promptInput = document.getElementById('promptInput');
|
29 |
+
const prompt = promptInput.value.trim();
|
30 |
+
if (prompt !== '') {
|
31 |
+
generateText(prompt);
|
32 |
+
}
|
33 |
+
});
|
34 |
+
function generateText(prompt) {
|
35 |
+
const apiUrl = 'https://aringad-test.hf.space/run';
|
36 |
+
const requestData = {
|
37 |
+
prompt: prompt,
|
38 |
+
model: 'OpenBuddy/openbuddy-llama3-8b-v21.1-8k'
|
39 |
+
};
|
40 |
+
fetch(apiUrl, {
|
41 |
+
method: 'POST',
|
42 |
+
headers: {
|
43 |
+
'Content-Type': 'application/json'
|
44 |
+
},
|
45 |
+
body: JSON.stringify(requestData)
|
46 |
+
})
|
47 |
+
.then(response => response.json())
|
48 |
+
.then(data => {
|
49 |
+
const generatedText = data.output;
|
50 |
+
document.getElementById('generatedText').textContent = generatedText;
|
51 |
+
document.getElementById('resultContainer').style.display = 'block';
|
52 |
+
})
|
53 |
+
.catch(error => {
|
54 |
+
console.error('Error:', error);
|
55 |
+
alert('An error occurred while generating text.');
|
56 |
+
});
|
57 |
+
}
|
58 |
+
</script>
|
59 |
+
</body>
|
60 |
+
</html>
|