forked from kennethnym/infinifi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e4e4fc5
commit e1866e0
Showing
4 changed files
with
67 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import asyncio | ||
from websockets.server import serve | ||
|
||
# from generate import generate | ||
|
||
|
||
async def handler(websocket): | ||
async for message in websocket: | ||
if message != "generate": | ||
continue | ||
|
||
print("generating new audio clips...") | ||
|
||
# generate() | ||
|
||
print("audio generated") | ||
|
||
for i in range(5): | ||
with open(f"{i + 5}.mp3", "rb") as f: | ||
data = f.read() | ||
await websocket.send(data) | ||
|
||
|
||
async def main(): | ||
async with serve(handler, "", 8001): | ||
await asyncio.Future() | ||
|
||
|
||
if __name__ == "__main__": | ||
asyncio.run(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
audiocraft==1.3.0 | ||
torchaudio==2.1.0 | ||
websockets==11.0.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
fastapi==0.111.1 | ||
websocket_client==1.8.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters