diff --git a/.gitignore b/.gitignore index 3df1f6e..a7272ff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .pypirc .env +.runtime.env .idea -test* -.runtime.env \ No newline at end of file +.venv +test* \ No newline at end of file diff --git a/src/BowongModalFunctions/router/comfyui.py b/src/BowongModalFunctions/router/comfyui.py index 0c7732c..dbea7ca 100644 --- a/src/BowongModalFunctions/router/comfyui.py +++ b/src/BowongModalFunctions/router/comfyui.py @@ -46,7 +46,7 @@ async def comfyui_v1(item: ComfyTaskRequest, headers: Annotated[SentryTransactio if headers.x_trace_id and headers.x_baggage: sentry_trace = SentryTransactionInfo(x_trace_id=headers.x_trace_id, x_baggage=headers.x_baggage) cls = modal.Cls.from_name(config.modal_app_name, "ComfyUI", environment_name=config.modal_environment) - fn_call = cls().api.spawn(item.video_path.path, item.start_time, item.filename_prefix, item.tts_text1, + fn_call = cls().api.spawn(item.video_path.path.replace(config.comfyui_s3_input+"/",""), item.start_time, item.filename_prefix, item.tts_text1, item.tts_text2, item.tts_text3, item.tts_text4, item.anchor_id, item.speed, sentry_trace, item.webhook) return ModalTaskResponse(success=True, taskId=fn_call.object_id) @@ -93,7 +93,7 @@ async def comfyui_v2(item: ComfyTaskRequest, headers: Annotated[SentryTransactio if headers.x_trace_id and headers.x_baggage: sentry_trace = SentryTransactionInfo(x_trace_id=headers.x_trace_id, x_baggage=headers.x_baggage) cls = modal.Cls.from_name(config.modal_app_name, "ComfyUILatentSync15", environment_name=config.modal_environment) - fn_call = cls().api.spawn(item.video_path.path, item.start_time, item.filename_prefix, item.tts_text1, + fn_call = cls().api.spawn(item.video_path.path.replace(config.comfyui_s3_input+"/",""), item.start_time, item.filename_prefix, item.tts_text1, item.tts_text2, item.tts_text3, item.tts_text4, item.anchor_id, item.speed, sentry_trace, item.webhook) return ModalTaskResponse(success=True, taskId=fn_call.object_id) diff --git a/src/cluster/web.py b/src/cluster/web.py index fd36bbd..75d7842 100644 --- a/src/cluster/web.py +++ b/src/cluster/web.py @@ -17,12 +17,22 @@ app = modal.App( with fastapi_image.imports(): from BowongModalFunctions.api import web_app + from BowongModalFunctions.config import WorkerConfig + config = WorkerConfig() @app.function(scaledown_window=60, secrets=[ modal.Secret.from_name("cf-kv-secret", environment_name='dev'), - ]) + ], + volumes={ + config.S3_mount_dir: modal.CloudBucketMount( + bucket_name=config.S3_bucket_name, + secret=modal.Secret.from_name("aws-s3-secret", + environment_name=config.modal_environment), + ), + }, + ) @modal.concurrent(max_inputs=100) @modal.asgi_app() def fastapi_webapp():