Spaces:
Paused
Paused
Commit
·
05dc8f9
1
Parent(s):
2615288
Update main.py
Browse files
main.py
CHANGED
|
@@ -5,7 +5,7 @@ from answerer import Answerer
|
|
| 5 |
|
| 6 |
answerer = Answerer(
|
| 7 |
repo="BlinkDL/rwkv-5-world",
|
| 8 |
-
filename="RWKV-5-World-3B-v2-20231118-ctx16k
|
| 9 |
vocab="rwkv_vocab_v20230424",
|
| 10 |
strategy="cpu bf16",
|
| 11 |
ctx_limit=16*1024,
|
|
@@ -20,8 +20,9 @@ HTML = """
|
|
| 20 |
|
| 21 |
<body>
|
| 22 |
<form action="" onsubmit="sendMessage(event)">
|
| 23 |
-
<input id="prompt" type="text" autocomplete="off"/>
|
| 24 |
-
<
|
|
|
|
| 25 |
</form>
|
| 26 |
|
| 27 |
<p id="output"></p>
|
|
@@ -29,7 +30,7 @@ HTML = """
|
|
| 29 |
const prompt = document.getElementById("prompt");
|
| 30 |
const output = document.getElementById("output");
|
| 31 |
|
| 32 |
-
const ws = new WebSocket("
|
| 33 |
ws.onmessage = function (event) => output.innerText = event.data;
|
| 34 |
|
| 35 |
function ask(event) {
|
|
@@ -53,4 +54,4 @@ async def answer(ws: WebSocket):
|
|
| 53 |
input = await ws.receive_text()
|
| 54 |
stream = answerer(input, 256)
|
| 55 |
for el in stream:
|
| 56 |
-
await ws.send_text(el)
|
|
|
|
| 5 |
|
| 6 |
answerer = Answerer(
|
| 7 |
repo="BlinkDL/rwkv-5-world",
|
| 8 |
+
filename="RWKV-5-World-3B-v2-20231118-ctx16k",
|
| 9 |
vocab="rwkv_vocab_v20230424",
|
| 10 |
strategy="cpu bf16",
|
| 11 |
ctx_limit=16*1024,
|
|
|
|
| 20 |
|
| 21 |
<body>
|
| 22 |
<form action="" onsubmit="sendMessage(event)">
|
| 23 |
+
<input id="prompt" type="text" autocomplete="off" />
|
| 24 |
+
<br>
|
| 25 |
+
<input type="submit" value="SEND" />
|
| 26 |
</form>
|
| 27 |
|
| 28 |
<p id="output"></p>
|
|
|
|
| 30 |
const prompt = document.getElementById("prompt");
|
| 31 |
const output = document.getElementById("output");
|
| 32 |
|
| 33 |
+
const ws = new WebSocket("ws://huggingface.co/spaces/DaniilAlpha/answerer-api:8000/answer");
|
| 34 |
ws.onmessage = function (event) => output.innerText = event.data;
|
| 35 |
|
| 36 |
function ask(event) {
|
|
|
|
| 54 |
input = await ws.receive_text()
|
| 55 |
stream = answerer(input, 256)
|
| 56 |
for el in stream:
|
| 57 |
+
await ws.send_text(el)
|