Spaces:
Running
Running
Ramesh-vani
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,11 @@
|
|
1 |
import websockets
|
2 |
import asyncio
|
3 |
import sys
|
|
|
4 |
|
5 |
|
6 |
URL = "wss://ramesh-vani-collab.hf.space"
|
|
|
7 |
|
8 |
async def receiver(ws,connection):
|
9 |
|
@@ -29,7 +31,7 @@ async def sender(ws,connection):
|
|
29 |
|
30 |
async def chat(websocket, path) -> None:
|
31 |
try:
|
32 |
-
async with websockets.connect(URL) as ws:
|
33 |
await asyncio.gather(
|
34 |
receiver(websocket,ws),
|
35 |
sender(websocket,ws)
|
|
|
1 |
import websockets
|
2 |
import asyncio
|
3 |
import sys
|
4 |
+
import os
|
5 |
|
6 |
|
7 |
URL = "wss://ramesh-vani-collab.hf.space"
|
8 |
+
headers = {'Authorization': f'Bearer {os.getenv("auth")}'}
|
9 |
|
10 |
async def receiver(ws,connection):
|
11 |
|
|
|
31 |
|
32 |
async def chat(websocket, path) -> None:
|
33 |
try:
|
34 |
+
async with websockets.connect(URL,extra_headers=headers) as ws:
|
35 |
await asyncio.gather(
|
36 |
receiver(websocket,ws),
|
37 |
sender(websocket,ws)
|