Spaces:
Sleeping
Sleeping
Create mainPrincipale.py
Browse files- mainPrincipale.py +27 -0
mainPrincipale.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI, Request
|
| 2 |
+
from fastapi.responses import HTMLResponse
|
| 3 |
+
from fastapi.staticfiles import StaticFiles
|
| 4 |
+
from fastapi.templating import Jinja2Templates
|
| 5 |
+
|
| 6 |
+
# Import the two apps
|
| 7 |
+
from qtAnswering.main import app as qa_app
|
| 8 |
+
from Summarization.main import app as sum_app
|
| 9 |
+
|
| 10 |
+
# Main app
|
| 11 |
+
app = FastAPI()
|
| 12 |
+
|
| 13 |
+
# Mount static folders
|
| 14 |
+
app.mount("/resources", StaticFiles(directory="resources"), name="resources")
|
| 15 |
+
app.mount("/static", StaticFiles(directory="static"), name="static")
|
| 16 |
+
|
| 17 |
+
# Mount sub-apps
|
| 18 |
+
app.mount("/qtAnswering", qa_app)
|
| 19 |
+
app.mount("/summarization", sum_app)
|
| 20 |
+
|
| 21 |
+
# Templates
|
| 22 |
+
templates = Jinja2Templates(directory="templates")
|
| 23 |
+
|
| 24 |
+
# Hello page route
|
| 25 |
+
@app.get("/", response_class=HTMLResponse)
|
| 26 |
+
async def hello_page(request: Request):
|
| 27 |
+
return templates.TemplateResponse("hellopage.html", {"request": request})
|