Add code for fal.ai integration #12

Merged
kennethnym merged 8 commits from fal-integration into main 2024-08-25 17:08:48 +01:00
5 changed files with 133 additions and 47 deletions
Showing only changes of commit b398f4d025 - Show all commits

View File

@@ -3,7 +3,6 @@ import os
from time import sleep from time import sleep
import requests import requests
import websocket
from contextlib import asynccontextmanager from contextlib import asynccontextmanager
from fastapi import FastAPI, WebSocket, WebSocketDisconnect, status from fastapi import FastAPI, WebSocket, WebSocketDisconnect, status
from fastapi.responses import FileResponse from fastapi.responses import FileResponse
@@ -15,8 +14,6 @@ from websocket_connection_manager import WebSocketConnectionManager
current_index = -1 current_index = -1
# the timer that periodically advances the current audio track # the timer that periodically advances the current audio track
t = None t = None
# websocket connection to the inference server
ws = None
inference_url = "" inference_url = ""
ws_connection_manager = WebSocketConnectionManager() ws_connection_manager = WebSocketConnectionManager()
active_listeners = set() active_listeners = set()
@@ -34,8 +31,6 @@ async def lifespan(app: FastAPI):
yield yield
if ws:
ws.close()
if t: if t:
t.cancel() t.cancel()