Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python | |
| # WS client example | |
| import asyncio | |
| import websockets | |
| async def hello(): | |
| uri = "wss://palondomus-caesarmusic.hf.space/caesarmusicws" | |
| async with websockets.connect(uri) as websocket: | |
| await websocket.send({"artist":"a boogie wit da hoodie","album":"hoodie szn","album_or_song":"album"}) | |
| while True: | |
| greeting = await websocket.recv() | |
| if "message" in greeting: | |
| print(greeting) | |
| if "finished"in greeting["message"]: | |
| break | |
| asyncio.get_event_loop().run_until_complete(hello()) |