zhaobenny f5fd4dc2a4
init
2023-12-28 00:19:52 -08:00

24 lines
439 B
Python

from fastapi import FastAPI
from modal import asgi_app
from a1111_modal_worker.setup import stub
from a1111_modal_worker.worker import A1111
web_app = FastAPI()
@web_app.get("{path:path}")
def forward_get(path: str):
return A1111.api_get.remote(path)
@web_app.post("{path:path}")
def forward_post(path: str, body: dict):
return A1111.api_post.remote(path, body)
@stub.function()
@asgi_app()
def webui():
return web_app