diff --git a/api/server.py b/api/server.py index 86739fb..a066a11 100644 --- a/api/server.py +++ b/api/server.py @@ -1,4 +1,5 @@ # server.py +import sys from pathlib import Path from typing import Union @@ -10,9 +11,12 @@ from pydantic import BaseModel +sys.path.append(str(Path(__file__).parent.parent)) + from ui.api import ImageMatchingAPI from ui.utils import DEVICE + class ImageInfo(BaseModel): image_path: str max_keypoints: int diff --git a/railway.toml b/railway.toml new file mode 100644 index 0000000..e2d8740 --- /dev/null +++ b/railway.toml @@ -0,0 +1,11 @@ +[build] +builder = "DOCKERFILE" +dockerfilePath = "Dockerfile" + +[deploy] +runtime = "V2" +numReplicas = 1 +startCommand = "python -m api.server" +sleepApplication = true +restartPolicyType = "ON_FAILURE" +restartPolicyMaxRetries = 10 \ No newline at end of file diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..b6da9bc --- /dev/null +++ b/vercel.json @@ -0,0 +1,18 @@ +{ + "builds": [ + { + "src": "api/server.py", + "use": "@vercel/python", + "config": { + "maxLambdaSize": "10gb", + "runtime": "python3.10" + } + } + ], + "routes": [ + { + "src": "/(.*)", + "dest": "api/server.py" + } + ] +} \ No newline at end of file