Spaces:
Running
Running
abadesalex
commited on
Commit
•
e747604
1
Parent(s):
260777c
midelware hhtps
Browse files- Api/app/main.py +12 -9
Api/app/main.py
CHANGED
@@ -1,19 +1,21 @@
|
|
1 |
import logging
|
2 |
from contextlib import asynccontextmanager
|
3 |
|
4 |
-
from app.modules.clearVariables.routes.clearVariables_route import
|
5 |
-
router as clear_variables_routes
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
10 |
from fastapi import APIRouter, FastAPI
|
11 |
from fastapi.middleware.cors import CORSMiddleware
|
12 |
from fastapi.middleware.httpsredirect import HTTPSRedirectMiddleware
|
13 |
from fastapi.responses import FileResponse
|
14 |
from fastapi.staticfiles import StaticFiles
|
15 |
-
from transformers import
|
16 |
-
pipeline)
|
17 |
|
18 |
|
19 |
@asynccontextmanager
|
@@ -52,13 +54,14 @@ origins = [
|
|
52 |
|
53 |
app.add_middleware(
|
54 |
CORSMiddleware,
|
55 |
-
HTTPSRedirectMiddleware,
|
56 |
allow_origins=origins,
|
57 |
allow_credentials=True,
|
58 |
allow_methods=["*"],
|
59 |
allow_headers=["*"],
|
60 |
)
|
61 |
|
|
|
|
|
62 |
app_router = APIRouter(prefix="/api")
|
63 |
app_router.include_router(upload_file_routes, prefix="/document", tags=["document"])
|
64 |
app_router.include_router(query_search_routes, prefix="/query", tags=["query"])
|
|
|
1 |
import logging
|
2 |
from contextlib import asynccontextmanager
|
3 |
|
4 |
+
from app.modules.clearVariables.routes.clearVariables_route import (
|
5 |
+
router as clear_variables_routes,
|
6 |
+
)
|
7 |
+
from app.modules.documentHandeler.routes.document_handeler_route import (
|
8 |
+
router as upload_file_routes,
|
9 |
+
)
|
10 |
+
from app.modules.querySearch.routes.querySearch_route import (
|
11 |
+
router as query_search_routes,
|
12 |
+
)
|
13 |
from fastapi import APIRouter, FastAPI
|
14 |
from fastapi.middleware.cors import CORSMiddleware
|
15 |
from fastapi.middleware.httpsredirect import HTTPSRedirectMiddleware
|
16 |
from fastapi.responses import FileResponse
|
17 |
from fastapi.staticfiles import StaticFiles
|
18 |
+
from transformers import AutoModel, AutoModelForMaskedLM, AutoTokenizer, pipeline
|
|
|
19 |
|
20 |
|
21 |
@asynccontextmanager
|
|
|
54 |
|
55 |
app.add_middleware(
|
56 |
CORSMiddleware,
|
|
|
57 |
allow_origins=origins,
|
58 |
allow_credentials=True,
|
59 |
allow_methods=["*"],
|
60 |
allow_headers=["*"],
|
61 |
)
|
62 |
|
63 |
+
app.add_middleware(HTTPSRedirectMiddleware)
|
64 |
+
|
65 |
app_router = APIRouter(prefix="/api")
|
66 |
app_router.include_router(upload_file_routes, prefix="/document", tags=["document"])
|
67 |
app_router.include_router(query_search_routes, prefix="/query", tags=["query"])
|