Spaces:
Sleeping
Sleeping
refactor: restructure project for multi-mode validation
Browse files
Dockerfile
CHANGED
|
@@ -15,6 +15,6 @@ RUN uv sync --frozen
|
|
| 15 |
# Expose port for FastAPI
|
| 16 |
EXPOSE 7860
|
| 17 |
|
| 18 |
-
# CMD
|
| 19 |
-
#
|
| 20 |
-
CMD ["uv", "run", "server"]
|
|
|
|
| 15 |
# Expose port for FastAPI
|
| 16 |
EXPOSE 7860
|
| 17 |
|
| 18 |
+
# CMD launches the API server by default
|
| 19 |
+
# uvicorn runs the FastAPI app from the server package
|
| 20 |
+
CMD ["uv", "run", "uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "7860"]
|
email_env_openenv.egg-info/SOURCES.txt
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
README.md
|
| 2 |
-
app.py
|
| 3 |
env.py
|
| 4 |
inference.py
|
| 5 |
models.py
|
|
@@ -10,4 +9,5 @@ email_env_openenv.egg-info/SOURCES.txt
|
|
| 10 |
email_env_openenv.egg-info/dependency_links.txt
|
| 11 |
email_env_openenv.egg-info/entry_points.txt
|
| 12 |
email_env_openenv.egg-info/requires.txt
|
| 13 |
-
email_env_openenv.egg-info/top_level.txt
|
|
|
|
|
|
| 1 |
README.md
|
|
|
|
| 2 |
env.py
|
| 3 |
inference.py
|
| 4 |
models.py
|
|
|
|
| 9 |
email_env_openenv.egg-info/dependency_links.txt
|
| 10 |
email_env_openenv.egg-info/entry_points.txt
|
| 11 |
email_env_openenv.egg-info/requires.txt
|
| 12 |
+
email_env_openenv.egg-info/top_level.txt
|
| 13 |
+
server/app.py
|
email_env_openenv.egg-info/entry_points.txt
CHANGED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
[console_scripts]
|
| 2 |
-
server = app:
|
|
|
|
| 1 |
[console_scripts]
|
| 2 |
+
server = server.app:main
|
email_env_openenv.egg-info/top_level.txt
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
-
app
|
| 2 |
env
|
| 3 |
inference
|
| 4 |
models
|
|
|
|
| 5 |
tasks
|
|
|
|
|
|
|
| 1 |
env
|
| 2 |
inference
|
| 3 |
models
|
| 4 |
+
server
|
| 5 |
tasks
|
pyproject.toml
CHANGED
|
@@ -11,19 +11,19 @@ dependencies = [
|
|
| 11 |
]
|
| 12 |
|
| 13 |
[project.scripts]
|
| 14 |
-
server = "app:
|
| 15 |
|
| 16 |
[build-system]
|
| 17 |
requires = ["setuptools>=42", "wheel"]
|
| 18 |
build-backend = "setuptools.build_meta"
|
| 19 |
|
| 20 |
[tool.setuptools]
|
| 21 |
-
py-modules = ["app", "env", "inference", "models", "tasks"]
|
| 22 |
|
| 23 |
|
| 24 |
[tool.hf.metadata]
|
| 25 |
sdk = "docker"
|
| 26 |
-
app_file = "app.py"
|
| 27 |
title = "email-env-openenv"
|
| 28 |
emoji = "🤖"
|
| 29 |
colorFrom = "blue"
|
|
|
|
| 11 |
]
|
| 12 |
|
| 13 |
[project.scripts]
|
| 14 |
+
server = "server.app:main"
|
| 15 |
|
| 16 |
[build-system]
|
| 17 |
requires = ["setuptools>=42", "wheel"]
|
| 18 |
build-backend = "setuptools.build_meta"
|
| 19 |
|
| 20 |
[tool.setuptools]
|
| 21 |
+
py-modules = ["server.app", "env", "inference", "models", "tasks"]
|
| 22 |
|
| 23 |
|
| 24 |
[tool.hf.metadata]
|
| 25 |
sdk = "docker"
|
| 26 |
+
app_file = "server/app.py"
|
| 27 |
title = "email-env-openenv"
|
| 28 |
emoji = "🤖"
|
| 29 |
colorFrom = "blue"
|
server/__pycache__/app.cpython-311.pyc
ADDED
|
Binary file (2.3 kB). View file
|
|
|
app.py → server/app.py
RENAMED
|
@@ -1,4 +1,10 @@
|
|
|
|
|
|
|
|
| 1 |
from fastapi import FastAPI
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
from env import EmailEnv
|
| 3 |
from inference import run_inference
|
| 4 |
|
|
@@ -27,7 +33,8 @@ def root():
|
|
| 27 |
|
| 28 |
def start_server():
|
| 29 |
import uvicorn
|
| 30 |
-
|
|
|
|
| 31 |
|
| 32 |
def main():
|
| 33 |
run_inference()
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import sys
|
| 3 |
from fastapi import FastAPI
|
| 4 |
+
|
| 5 |
+
# Add the parent directory to sys.path to allow importing root-level modules
|
| 6 |
+
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
| 7 |
+
|
| 8 |
from env import EmailEnv
|
| 9 |
from inference import run_inference
|
| 10 |
|
|
|
|
| 33 |
|
| 34 |
def start_server():
|
| 35 |
import uvicorn
|
| 36 |
+
# Now that app is in the server package, we need the full import path
|
| 37 |
+
uvicorn.run("server.app:app", host="0.0.0.0", port=7860)
|
| 38 |
|
| 39 |
def main():
|
| 40 |
run_inference()
|