Spaces:
Paused
Paused
Create index.html
Browse files- index.html +18 -0
index.html
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<textarea id="input" placeholder="Paste text here..."></textarea>
|
| 2 |
+
<button id="go">Summarize</button>
|
| 3 |
+
<pre id="out"></pre>
|
| 4 |
+
|
| 5 |
+
<script type="module">
|
| 6 |
+
import { Client } from "https://cdn.jsdelivr.net/npm/@gradio/client/dist/index.min.js";
|
| 7 |
+
const client = await Client.connect("yourname-summarizer.hf.space");
|
| 8 |
+
|
| 9 |
+
document.getElementById("go").onclick = async () => {
|
| 10 |
+
const text = document.getElementById("input").value;
|
| 11 |
+
const out = document.getElementById("out");
|
| 12 |
+
out.textContent = "";
|
| 13 |
+
const job = client.submit("/summarize", { text });
|
| 14 |
+
for await (const msg of job) {
|
| 15 |
+
if (msg.type === "data") out.textContent = msg.data[0];
|
| 16 |
+
}
|
| 17 |
+
};
|
| 18 |
+
</script>
|