Skip to content

Commit

Permalink
Update CORS middleware configuration in picpilot.py
Browse files Browse the repository at this point in the history
  • Loading branch information
VikramxD committed Oct 16, 2024
1 parent e34a3ae commit 189436f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions api/picpilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
from configs.tti_settings import tti_settings
from outpainting_serve import OutpaintingAPI
from image2video_serve import ImageToVideoAPI
from fastapi.middleware.cors import CORSMiddleware

origins = [
"*", # Allow all origins
]


flux_server = LitServer(FluxInpaintingAPI(), api_path='/api/v2/painting/flux', accelerator="auto",devices='auto', max_batch_size=4, batch_timeout=0.1)
sdxl_server = LitServer(SDXLLoraAPI(), api_path='/api/v2/generate/sdxl', accelerator="auto",devices='auto', max_batch_size=tti_settings.MAX_BATCH_SIZE, batch_timeout=tti_settings.MAX_QUEUE_DELAY_MICROSECONDS / 1e6)
outpainting_server = LitServer(OutpaintingAPI(), api_path='/api/v2/painting/sdxl_outpainting', accelerator='auto',devices='auto', max_batch_size=4, batch_timeout=0.1)
image2video_server = LitServer(ImageToVideoAPI(), api_path='/api/v2/image2video/cogvideox', accelerator='auto',devices='auto', max_batch_size=1, batch_timeout=0.1)
flux_server = LitServer(FluxInpaintingAPI(), api_path='/api/v2/painting/flux', accelerator="auto",devices='auto', max_batch_size=4, batch_timeout=0.1,middlewares=((CORSMiddleware, {"allow_origins": origins, "allow_credentials": True, "allow_methods": ["*"], "allow_headers": ["*"],}),))
sdxl_server = LitServer(SDXLLoraAPI(), api_path='/api/v2/generate/sdxl', accelerator="auto",devices='auto', max_batch_size=tti_settings.MAX_BATCH_SIZE, batch_timeout=tti_settings.MAX_QUEUE_DELAY_MICROSECONDS / 1e6, middlewares=((CORSMiddleware, {"allow_origins": origins, "allow_credentials": True, "allow_methods": ["*"], "allow_headers": ["*"],}),))
outpainting_server = LitServer(OutpaintingAPI(), api_path='/api/v2/painting/sdxl_outpainting', accelerator='auto',devices='auto', max_batch_size=4, batch_timeout=0.1,middlewares=((CORSMiddleware, {"allow_origins": origins, "allow_credentials": True, "allow_methods": ["*"], "allow_headers": ["*"],}),))
image2video_server = LitServer(ImageToVideoAPI(), api_path='/api/v2/image2video/cogvideox', accelerator='auto',devices='auto', max_batch_size=1, batch_timeout=0.1,middlewares=((CORSMiddleware, {"allow_origins": origins, "allow_credentials": True, "allow_methods": ["*"], "allow_headers": ["*"],}),))


if __name__ == '__main__':
Expand Down

0 comments on commit 189436f

Please sign in to comment.