From a05f7b936f8f53f96184bd88a5f49b0bc8f35b20 Mon Sep 17 00:00:00 2001 From: "kyj@bowong.ai" Date: Tue, 20 May 2025 15:03:25 +0800 Subject: [PATCH] =?UTF-8?q?FIX=20=E4=BF=AE=E5=A4=8D=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E8=B7=AF=E5=BE=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 +++-- src/BowongModalFunctions/router/comfyui.py | 4 ++-- src/cluster/web.py | 12 +++++++++++- 3 files changed, 16 insertions(+), 5 deletions(-) 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():