fix server entry point with main function
Browse files- pyproject.toml +1 -1
- server/app.py +10 -5
pyproject.toml
CHANGED
|
@@ -22,7 +22,7 @@ dependencies = [
|
|
| 22 |
]
|
| 23 |
|
| 24 |
[project.scripts]
|
| 25 |
-
server = "app:
|
| 26 |
|
| 27 |
[tool.openenv]
|
| 28 |
name = "voice-authenticity"
|
|
|
|
| 22 |
]
|
| 23 |
|
| 24 |
[project.scripts]
|
| 25 |
+
server = "server.app:main"
|
| 26 |
|
| 27 |
[tool.openenv]
|
| 28 |
name = "voice-authenticity"
|
server/app.py
CHANGED
|
@@ -4,16 +4,18 @@ from pydantic import BaseModel
|
|
| 4 |
from typing import Optional
|
| 5 |
import uvicorn
|
| 6 |
import os
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
from environment.env import VoiceAuthenticityEnv
|
| 9 |
|
| 10 |
app = FastAPI(title="Voice Authenticity OpenEnv")
|
| 11 |
|
| 12 |
-
# Global env instances per task
|
| 13 |
envs = {
|
| 14 |
-
"clean_detection":
|
| 15 |
-
"compressed_detection":
|
| 16 |
-
"adversarial_detection":VoiceAuthenticityEnv("adversarial_detection"),
|
| 17 |
}
|
| 18 |
|
| 19 |
current_task = "clean_detection"
|
|
@@ -70,5 +72,8 @@ def health():
|
|
| 70 |
def root():
|
| 71 |
return {"name": "voice-authenticity-openenv", "status": "running"}
|
| 72 |
|
|
|
|
|
|
|
|
|
|
| 73 |
if __name__ == "__main__":
|
| 74 |
-
|
|
|
|
| 4 |
from typing import Optional
|
| 5 |
import uvicorn
|
| 6 |
import os
|
| 7 |
+
import sys
|
| 8 |
+
|
| 9 |
+
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
| 10 |
|
| 11 |
from environment.env import VoiceAuthenticityEnv
|
| 12 |
|
| 13 |
app = FastAPI(title="Voice Authenticity OpenEnv")
|
| 14 |
|
|
|
|
| 15 |
envs = {
|
| 16 |
+
"clean_detection": VoiceAuthenticityEnv("clean_detection"),
|
| 17 |
+
"compressed_detection": VoiceAuthenticityEnv("compressed_detection"),
|
| 18 |
+
"adversarial_detection": VoiceAuthenticityEnv("adversarial_detection"),
|
| 19 |
}
|
| 20 |
|
| 21 |
current_task = "clean_detection"
|
|
|
|
| 72 |
def root():
|
| 73 |
return {"name": "voice-authenticity-openenv", "status": "running"}
|
| 74 |
|
| 75 |
+
def main():
|
| 76 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|
| 77 |
+
|
| 78 |
if __name__ == "__main__":
|
| 79 |
+
main()
|