Spaces:
Running
Running
Update index.html
Browse files- index.html +14 -2
index.html
CHANGED
@@ -17,7 +17,7 @@
|
|
17 |
<a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
|
18 |
</p>
|
19 |
</div>
|
20 |
-
<br/><br/><br
|
21 |
<form id="hf-form">
|
22 |
<!-- Hidden username field for accessibility -->
|
23 |
<input
|
@@ -35,6 +35,17 @@
|
|
35 |
autocomplete="new-password"
|
36 |
/>
|
37 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
<input type="submit" value="Translate"/>
|
39 |
</form>
|
40 |
|
@@ -44,12 +55,13 @@
|
|
44 |
document.getElementById('hf-form').addEventListener('submit', async (event) => {
|
45 |
event.preventDefault();
|
46 |
const token = document.getElementById('hf-token').value;
|
|
|
47 |
const hf = new HfInference(token);
|
48 |
|
49 |
// You can also omit "model" to use the recommended model for the task
|
50 |
const result = await hf.translation({
|
51 |
model: 't5-base',
|
52 |
-
inputs:
|
53 |
});
|
54 |
console.log(result);
|
55 |
});
|
|
|
17 |
<a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
|
18 |
</p>
|
19 |
</div>
|
20 |
+
<br/><br/><br/>
|
21 |
<form id="hf-form">
|
22 |
<!-- Hidden username field for accessibility -->
|
23 |
<input
|
|
|
35 |
autocomplete="new-password"
|
36 |
/>
|
37 |
</div>
|
38 |
+
|
39 |
+
<div>
|
40 |
+
<label for="text-to-translate">Text to Translate</label>
|
41 |
+
<input
|
42 |
+
id="text-to-translate"
|
43 |
+
placeholder='My name is Wolfgang and I live in Amsterdam'
|
44 |
+
type="text"
|
45 |
+
autocomplete="off"
|
46 |
+
/>
|
47 |
+
</div>
|
48 |
+
|
49 |
<input type="submit" value="Translate"/>
|
50 |
</form>
|
51 |
|
|
|
55 |
document.getElementById('hf-form').addEventListener('submit', async (event) => {
|
56 |
event.preventDefault();
|
57 |
const token = document.getElementById('hf-token').value;
|
58 |
+
const textToTranslate = document.getElementById('text-to-translate').value;
|
59 |
const hf = new HfInference(token);
|
60 |
|
61 |
// You can also omit "model" to use the recommended model for the task
|
62 |
const result = await hf.translation({
|
63 |
model: 't5-base',
|
64 |
+
inputs: textToTranslate,
|
65 |
});
|
66 |
console.log(result);
|
67 |
});
|