Spaces:
Runtime error
Runtime error
Commit ·
5b76cc5
1
Parent(s): b688bec
fixing pydantic issue v9
Browse files- main/main.py +6 -12
main/main.py
CHANGED
|
@@ -23,7 +23,7 @@ def load_config():
|
|
| 23 |
with open(config_path) as f:
|
| 24 |
return yaml.safe_load(f)
|
| 25 |
|
| 26 |
-
def
|
| 27 |
"""Create and configure the application instance."""
|
| 28 |
logger = setup_logging()
|
| 29 |
|
|
@@ -55,20 +55,14 @@ def create_app():
|
|
| 55 |
# Add our routes to the server's FastAPI app
|
| 56 |
server.app.include_router(router, prefix="/api/v1")
|
| 57 |
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
except Exception as e:
|
| 61 |
logger.error(f"Server initialization failed: {str(e)}")
|
| 62 |
raise
|
| 63 |
|
| 64 |
-
# Create the application instance
|
| 65 |
-
app = create_app()
|
| 66 |
-
|
| 67 |
-
|
| 68 |
if __name__ == "__main__":
|
| 69 |
-
|
| 70 |
-
config = load_config()
|
| 71 |
-
port = config.get("server", {}).get("port", 8001)
|
| 72 |
-
|
| 73 |
-
# Get the server instance from our app and run it
|
| 74 |
-
app.parent.run(port=port) # assuming the LitServer instance is stored as parent
|
|
|
|
| 23 |
with open(config_path) as f:
|
| 24 |
return yaml.safe_load(f)
|
| 25 |
|
| 26 |
+
def main():
|
| 27 |
"""Create and configure the application instance."""
|
| 28 |
logger = setup_logging()
|
| 29 |
|
|
|
|
| 55 |
# Add our routes to the server's FastAPI app
|
| 56 |
server.app.include_router(router, prefix="/api/v1")
|
| 57 |
|
| 58 |
+
port = config.get("server", {}).get("port", 8001)
|
| 59 |
+
|
| 60 |
+
# Get the server instance from our app and run it
|
| 61 |
+
server.run(port=port) # assuming the LitServer instance is stored as parent
|
| 62 |
|
| 63 |
except Exception as e:
|
| 64 |
logger.error(f"Server initialization failed: {str(e)}")
|
| 65 |
raise
|
| 66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
if __name__ == "__main__":
|
| 68 |
+
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|