aringad commited on
Commit
d259564
1 Parent(s): b5aa17b

index2.html

Browse files
Files changed (1) hide show
  1. index2.html +62 -0
index2.html ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
35
+ function generateText(prompt) {
36
+ const apiUrl = 'https://aringad-test.hf.space/run';
37
+ const requestData = {
38
+ prompt: prompt,
39
+ model: 'OpenBuddy/openbuddy-llama3-8b-v21.1-8k'
40
+ };
41
+
42
+ fetch(apiUrl, {
43
+ method: 'POST',
44
+ headers: {
45
+ 'Content-Type': 'application/json'
46
+ },
47
+ body: JSON.stringify(requestData)
48
+ })
49
+ .then(response => response.json())
50
+ .then(data => {
51
+ const generatedText = data.output;
52
+ document.getElementById('generatedText').textContent = generatedText;
53
+ document.getElementById('resultContainer').style.display = 'block';
54
+ })
55
+ .catch(error => {
56
+ console.error('Error:', error);
57
+ alert('An error occurred while generating text.');
58
+ });
59
+ }
60
+ </script>
61
+ </body>
62
+ </html>