Spaces:
Paused
Paused
Commit
·
e063347
1
Parent(s):
239df0b
Update main.py
Browse files
main.py
CHANGED
@@ -29,7 +29,6 @@ HTML = """
|
|
29 |
const prompt = document.getElementById("prompt");
|
30 |
const output = document.getElementById("output");
|
31 |
|
32 |
-
// TODO!
|
33 |
const ws = new WebSocket("wss://daniilalpha-answerer-api.hf.space/answer");
|
34 |
ws.onmessage = (e) => answer(e.data);
|
35 |
|
@@ -62,23 +61,7 @@ async def answer(ws: WebSocket):
|
|
62 |
|
63 |
input = await ws.receive_text()
|
64 |
output = answerer(input, 32)
|
65 |
-
async for el in output:
|
66 |
-
await ws.send_text(el)
|
67 |
-
|
68 |
-
await ws.close()
|
69 |
-
|
70 |
-
async def answerer_test():
|
71 |
-
for i in range(10000):
|
72 |
-
yield f"i"
|
73 |
-
|
74 |
-
@app.websocket("/answer_test")
|
75 |
-
async def answer(ws: WebSocket):
|
76 |
-
await ws.accept()
|
77 |
-
|
78 |
-
input = await ws.receive_text()
|
79 |
-
output = answerer_test()
|
80 |
for el in output:
|
81 |
-
print(el)
|
82 |
await ws.send_text(el)
|
83 |
|
84 |
await ws.close()
|
|
|
29 |
const prompt = document.getElementById("prompt");
|
30 |
const output = document.getElementById("output");
|
31 |
|
|
|
32 |
const ws = new WebSocket("wss://daniilalpha-answerer-api.hf.space/answer");
|
33 |
ws.onmessage = (e) => answer(e.data);
|
34 |
|
|
|
61 |
|
62 |
input = await ws.receive_text()
|
63 |
output = answerer(input, 32)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
for el in output:
|
|
|
65 |
await ws.send_text(el)
|
66 |
|
67 |
await ws.close()
|