Spaces:
Sleeping
Sleeping
Update static/index.html
Browse files- static/index.html +17 -20
static/index.html
CHANGED
@@ -1,4 +1,12 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
<body>
|
3 |
<!-- Add the Loader -->
|
4 |
<div id="loader">
|
@@ -7,75 +15,63 @@
|
|
7 |
|
8 |
<!-- Original Content -->
|
9 |
<main><section id="text-gen">
|
10 |
-
<h2>Text generation using
|
11 |
<p>
|
12 |
Model:
|
13 |
<a
|
14 |
-
href="https://huggingface.co/
|
15 |
rel="noreferrer"
|
16 |
target="_blank"
|
17 |
-
>
|
18 |
</a>
|
19 |
</p>
|
20 |
<form class="text-gen-form">
|
21 |
<label for="text-gen-input">Text prompt</label>
|
22 |
-
<input id="text-gen-input" type="text" value="
|
23 |
<button id="text-gen-submit">Submit</button>
|
24 |
<p class="text-gen-output"></p>
|
25 |
</form>
|
26 |
</section></main>
|
27 |
|
28 |
<!-- Other resources -->
|
29 |
-
<link href="/static/style.css" rel="stylesheet">
|
30 |
<script>
|
31 |
document.addEventListener('DOMContentLoaded', () => {
|
32 |
const loader = document.getElementById('loader');
|
33 |
const textGenInput = document.getElementById('text-gen-input');
|
34 |
const textGenOutput = document.querySelector('.text-gen-output');
|
35 |
-
|
36 |
/* Function to hide the loader */
|
37 |
const hideLoader = () => {
|
38 |
loader.classList.add('hidden');
|
39 |
};
|
40 |
-
|
41 |
/* Function to show the loader */
|
42 |
const showLoader = () => {
|
43 |
loader.classList.remove('hidden');
|
44 |
};
|
45 |
-
|
46 |
/* Submit Button Event Listener */
|
47 |
const textGenForm = document.querySelector('.text-gen-form');
|
48 |
textGenForm.addEventListener('submit', async (event) => {
|
49 |
event.preventDefault();
|
50 |
-
|
51 |
/* Hide the loader initially */
|
52 |
hideLoader();
|
53 |
-
|
54 |
/* Get the input value */
|
55 |
const inputValue = textGenInput.value;
|
56 |
-
|
57 |
/* Show the loader before making the request */
|
58 |
showLoader();
|
59 |
-
|
60 |
try {
|
61 |
-
/* Send a POST request to the /
|
62 |
-
const response = await fetch('/
|
63 |
method: 'POST',
|
64 |
headers: {
|
65 |
'Content-Type': 'application/json'
|
66 |
},
|
67 |
body: JSON.stringify({ input: inputValue })
|
68 |
});
|
69 |
-
|
70 |
/* Parse the response as JSON */
|
71 |
const data = await response.json();
|
72 |
-
|
73 |
/* Clear the output paragraph */
|
74 |
textGenOutput.innerHTML = '';
|
75 |
-
|
76 |
/* Display the generated text in the output paragraph */
|
77 |
textGenOutput.insertAdjacentHTML('beforeend', `<span>${data.output}</span>`);
|
78 |
-
|
79 |
/* Hide the loader finally */
|
80 |
hideLoader();
|
81 |
} catch (err) {
|
@@ -86,4 +82,5 @@
|
|
86 |
});
|
87 |
});
|
88 |
</script>
|
89 |
-
</body>
|
|
|
|
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>Text Generation using miqu-1-70b-sf</title>
|
7 |
+
<!-- Other resources -->
|
8 |
+
<link href="/static/style.css" rel="stylesheet">
|
9 |
+
</head>
|
10 |
<body>
|
11 |
<!-- Add the Loader -->
|
12 |
<div id="loader">
|
|
|
15 |
|
16 |
<!-- Original Content -->
|
17 |
<main><section id="text-gen">
|
18 |
+
<h2>Text generation using miqu-1-70b-sf</h2>
|
19 |
<p>
|
20 |
Model:
|
21 |
<a
|
22 |
+
href="https://huggingface.co/152334H/miqu-1-70b-sf"
|
23 |
rel="noreferrer"
|
24 |
target="_blank"
|
25 |
+
>152334H/miqu-1-70b-sf
|
26 |
</a>
|
27 |
</p>
|
28 |
<form class="text-gen-form">
|
29 |
<label for="text-gen-input">Text prompt</label>
|
30 |
+
<input id="text-gen-input" type="text" value="[INST] eloquent high camp prose about a cute catgirl [/INST]"/>
|
31 |
<button id="text-gen-submit">Submit</button>
|
32 |
<p class="text-gen-output"></p>
|
33 |
</form>
|
34 |
</section></main>
|
35 |
|
36 |
<!-- Other resources -->
|
|
|
37 |
<script>
|
38 |
document.addEventListener('DOMContentLoaded', () => {
|
39 |
const loader = document.getElementById('loader');
|
40 |
const textGenInput = document.getElementById('text-gen-input');
|
41 |
const textGenOutput = document.querySelector('.text-gen-output');
|
|
|
42 |
/* Function to hide the loader */
|
43 |
const hideLoader = () => {
|
44 |
loader.classList.add('hidden');
|
45 |
};
|
|
|
46 |
/* Function to show the loader */
|
47 |
const showLoader = () => {
|
48 |
loader.classList.remove('hidden');
|
49 |
};
|
|
|
50 |
/* Submit Button Event Listener */
|
51 |
const textGenForm = document.querySelector('.text-gen-form');
|
52 |
textGenForm.addEventListener('submit', async (event) => {
|
53 |
event.preventDefault();
|
|
|
54 |
/* Hide the loader initially */
|
55 |
hideLoader();
|
|
|
56 |
/* Get the input value */
|
57 |
const inputValue = textGenInput.value;
|
|
|
58 |
/* Show the loader before making the request */
|
59 |
showLoader();
|
|
|
60 |
try {
|
61 |
+
/* Send a POST request to the /generate_text endpoint with the input value as JSON data */
|
62 |
+
const response = await fetch('/generate_text', {
|
63 |
method: 'POST',
|
64 |
headers: {
|
65 |
'Content-Type': 'application/json'
|
66 |
},
|
67 |
body: JSON.stringify({ input: inputValue })
|
68 |
});
|
|
|
69 |
/* Parse the response as JSON */
|
70 |
const data = await response.json();
|
|
|
71 |
/* Clear the output paragraph */
|
72 |
textGenOutput.innerHTML = '';
|
|
|
73 |
/* Display the generated text in the output paragraph */
|
74 |
textGenOutput.insertAdjacentHTML('beforeend', `<span>${data.output}</span>`);
|
|
|
75 |
/* Hide the loader finally */
|
76 |
hideLoader();
|
77 |
} catch (err) {
|
|
|
82 |
});
|
83 |
});
|
84 |
</script>
|
85 |
+
</body>
|
86 |
+
</html>
|