aringad commited on
Commit
69bb670
1 Parent(s): d259564

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +59 -18
index.html CHANGED
@@ -1,19 +1,60 @@
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>
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>