Spaces:
Sleeping
Sleeping
Update server/app.py
Browse files- server/app.py +9 -7
server/app.py
CHANGED
|
@@ -1049,20 +1049,22 @@ async def get_schemas() -> SchemaResponse:
|
|
| 1049 |
state=AetherTaskFlowState.model_json_schema(),
|
| 1050 |
)
|
| 1051 |
|
| 1052 |
-
|
| 1053 |
-
|
| 1054 |
-
|
| 1055 |
import uvicorn
|
| 1056 |
uvicorn.run(app, host=host, port=port)
|
| 1057 |
|
| 1058 |
|
| 1059 |
-
|
| 1060 |
import argparse
|
| 1061 |
parser = argparse.ArgumentParser(description="AETHER-TaskFlow server")
|
| 1062 |
parser.add_argument("--host", default="0.0.0.0")
|
| 1063 |
parser.add_argument("--port", type=int, default=7860)
|
| 1064 |
parser.add_argument("--difficulty", choices=["easy", "medium", "hard"], default=_DIFFICULTY)
|
| 1065 |
args = parser.parse_args()
|
| 1066 |
-
|
| 1067 |
-
|
| 1068 |
-
|
|
|
|
|
|
|
|
|
| 1049 |
state=AetherTaskFlowState.model_json_schema(),
|
| 1050 |
)
|
| 1051 |
|
| 1052 |
+
def _run_server(host: str, port: int, difficulty: str) -> None:
|
| 1053 |
+
if difficulty != _DIFFICULTY:
|
| 1054 |
+
os.environ["AETHER_DIFFICULTY"] = difficulty
|
| 1055 |
import uvicorn
|
| 1056 |
uvicorn.run(app, host=host, port=port)
|
| 1057 |
|
| 1058 |
|
| 1059 |
+
def main() -> None:
|
| 1060 |
import argparse
|
| 1061 |
parser = argparse.ArgumentParser(description="AETHER-TaskFlow server")
|
| 1062 |
parser.add_argument("--host", default="0.0.0.0")
|
| 1063 |
parser.add_argument("--port", type=int, default=7860)
|
| 1064 |
parser.add_argument("--difficulty", choices=["easy", "medium", "hard"], default=_DIFFICULTY)
|
| 1065 |
args = parser.parse_args()
|
| 1066 |
+
_run_server(host=args.host, port=args.port, difficulty=args.difficulty)
|
| 1067 |
+
|
| 1068 |
+
|
| 1069 |
+
if __name__ == "__main__":
|
| 1070 |
+
main()
|