Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,42 +1,10 @@
|
|
1 |
-
|
2 |
-
from
|
3 |
import uvicorn
|
4 |
|
5 |
-
#
|
6 |
-
|
7 |
-
title="AI-Powered Test Automation Framework",
|
8 |
-
description="An intelligent test automation framework powered by AI",
|
9 |
-
version="1.0.0"
|
10 |
-
)
|
11 |
|
12 |
-
#
|
13 |
-
app.add_middleware(
|
14 |
-
CORSMiddleware,
|
15 |
-
allow_origins=["*"],
|
16 |
-
allow_credentials=True,
|
17 |
-
allow_methods=["*"],
|
18 |
-
allow_headers=["*"],
|
19 |
-
)
|
20 |
-
|
21 |
-
# Health check endpoint
|
22 |
-
@app.get("/")
|
23 |
-
async def root():
|
24 |
-
return {
|
25 |
-
"message": "Welcome to AI-Powered Test Automation Framework",
|
26 |
-
"status": "healthy",
|
27 |
-
"docs_url": "/docs"
|
28 |
-
}
|
29 |
-
|
30 |
-
# Import and include other routers
|
31 |
-
from api.routes import document_routes, ai_routes, test_routes, automation_routes
|
32 |
-
|
33 |
-
app.include_router(document_routes.router, prefix="/api/documents", tags=["Documents"])
|
34 |
-
app.include_router(ai_routes.router, prefix="/api/ai", tags=["AI"])
|
35 |
-
app.include_router(test_routes.router, prefix="/api/tests", tags=["Tests"])
|
36 |
-
app.include_router(automation_routes.router, prefix="/api/automation", tags=["Automation"])
|
37 |
-
|
38 |
-
# Run the application
|
39 |
if __name__ == "__main__":
|
40 |
-
import os
|
41 |
-
port = int(os.getenv("PORT", 7860))
|
42 |
uvicorn.run(app, host="0.0.0.0", port=port)
|
|
|
1 |
+
import os
|
2 |
+
from app.main import app
|
3 |
import uvicorn
|
4 |
|
5 |
+
# Get port from environment variable or default to 7860
|
6 |
+
port = int(os.getenv("PORT", 7860))
|
|
|
|
|
|
|
|
|
7 |
|
8 |
+
# Run the FastAPI application
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
if __name__ == "__main__":
|
|
|
|
|
10 |
uvicorn.run(app, host="0.0.0.0", port=port)
|