Spaces:
Paused
Paused
Commit
·
8b0801b
1
Parent(s):
02d3ca6
- accelerator.py +3 -2
- main.py +1 -1
accelerator.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
from typing import Union
|
2 |
-
from fastapi.websockets import WebSocket
|
|
|
3 |
|
4 |
class Accelerator:
|
5 |
ws: Union[WebSocket, None] = None
|
@@ -14,5 +15,5 @@ class Accelerator:
|
|
14 |
try:
|
15 |
await self.ws.send_text(input)
|
16 |
return await self.ws.receive_text()
|
17 |
-
except
|
18 |
self.ws = None
|
|
|
1 |
from typing import Union
|
2 |
+
from fastapi.websockets import WebSocket
|
3 |
+
from websockets import ConnectionClosedError
|
4 |
|
5 |
class Accelerator:
|
6 |
ws: Union[WebSocket, None] = None
|
|
|
15 |
try:
|
16 |
await self.ws.send_text(input)
|
17 |
return await self.ws.receive_text()
|
18 |
+
except ConnectionClosedError:
|
19 |
self.ws = None
|
main.py
CHANGED
@@ -31,7 +31,7 @@ HTML = """
|
|
31 |
|
32 |
<body>
|
33 |
<form action="" onsubmit="ask(event)">
|
34 |
-
<
|
35 |
<br>
|
36 |
<input type="submit" value="SEND" />
|
37 |
</form>
|
|
|
31 |
|
32 |
<body>
|
33 |
<form action="" onsubmit="ask(event)">
|
34 |
+
<textarea id="prompt"></textarea>
|
35 |
<br>
|
36 |
<input type="submit" value="SEND" />
|
37 |
</form>
|