DaniilAlpha commited on
Commit
4f7a77c
·
1 Parent(s): 6942628

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +6 -4
main.py CHANGED
@@ -5,7 +5,7 @@ from answerer import Answerer
5
 
6
  answerer = Answerer(
7
  repo="BlinkDL/rwkv-5-world",
8
- model="RWKV-5-World-3B-v2-20231118-ctx16k",
9
  vocab="rwkv_vocab_v20230424",
10
  strategy="cpu bf16",
11
  ctx_limit=16*1024,
@@ -25,13 +25,15 @@ HTML = """
25
  <input type="submit" value="SEND" />
26
  </form>
27
 
28
- <p id="output"></p>
29
  <script>
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) {
37
  ws.send(prompt.value);
@@ -54,4 +56,4 @@ async def answer(ws: WebSocket):
54
  input = await ws.receive_text()
55
  stream = answerer(input, 256)
56
  for el in stream:
57
- 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,
 
25
  <input type="submit" value="SEND" />
26
  </form>
27
 
28
+ <p id="output" placeholder="Output"></p>
29
  <script>
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) {
35
+ output.innerText = event.data;
36
+ }
37
 
38
  function ask(event) {
39
  ws.send(prompt.value);
 
56
  input = await ws.receive_text()
57
  stream = answerer(input, 256)
58
  for el in stream:
59
+ await ws.send_text(el)