Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,42 @@
|
|
1 |
-
import os
|
2 |
-
from app.main import app
|
3 |
-
import uvicorn
|
4 |
from fastapi import FastAPI
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
@app.get("/")
|
8 |
async def root():
|
9 |
return {
|
10 |
-
"
|
11 |
-
"
|
12 |
-
"
|
13 |
}
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
if __name__ == "__main__":
|
16 |
-
|
17 |
port = int(os.getenv("PORT", 7860))
|
18 |
-
uvicorn.run(app, host="0.0.0.0", port=port)
|
|
|
|
|
|
|
|
|
1 |
from fastapi import FastAPI
|
2 |
+
from fastapi.middleware.cors import CORSMiddleware
|
3 |
+
import uvicorn
|
4 |
+
|
5 |
+
# Create FastAPI app
|
6 |
+
app = FastAPI(
|
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 |
+
# Add CORS middleware
|
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)
|