abadesalex commited on
Commit
39f6b9b
·
1 Parent(s): e4b1fbd

Debug API key

Browse files
Files changed (2) hide show
  1. Api/app/main.py +6 -16
  2. Api/app/qdrant.py +2 -5
Api/app/main.py CHANGED
@@ -1,29 +1,20 @@
1
  import logging
2
  from contextlib import asynccontextmanager
3
 
4
- import uvicorn
5
- from fastapi import APIRouter, FastAPI
6
- from fastapi.middleware.cors import CORSMiddleware
7
- from fastapi.responses import FileResponse
8
- from fastapi.staticfiles import StaticFiles
9
- from transformers import AutoModel, AutoModelForMaskedLM, AutoTokenizer, pipeline
10
-
11
  from app.modules.clearVariables.routes.clearVariables_route import \
12
  router as clear_variables_routes
13
  from app.modules.documentHandeler.routes.document_handeler_route import \
14
  router as upload_file_routes
15
  from app.modules.querySearch.routes.querySearch_route import \
16
  router as query_search_routes
 
 
 
 
 
 
17
 
18
 
19
- from dotenv import load_dotenv
20
- import os
21
- from app.service.api import baseURL
22
-
23
- load_dotenv()
24
- api_key = os.getenv("QDRANT_API_KEY")
25
- print("Api key: ", api_key)
26
-
27
  @asynccontextmanager
28
  async def lifespan(app: FastAPI):
29
  dense_model_name = "sentence-transformers/all-MiniLM-L6-v2"
@@ -37,7 +28,6 @@ async def lifespan(app: FastAPI):
37
  sparse_model = AutoModelForMaskedLM.from_pretrained(sparse_model_name)
38
 
39
  qa_pipeline = pipeline("question-answering", model=qa_model_name)
40
- print("Api key: ", api_key)
41
 
42
  yield {
43
  "dense_tokenizer": dense_tokenizer,
 
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
  from app.modules.documentHandeler.routes.document_handeler_route import \
7
  router as upload_file_routes
8
  from app.modules.querySearch.routes.querySearch_route import \
9
  router as query_search_routes
10
+ from fastapi import APIRouter, FastAPI
11
+ from fastapi.middleware.cors import CORSMiddleware
12
+ from fastapi.responses import FileResponse
13
+ from fastapi.staticfiles import StaticFiles
14
+ from transformers import (AutoModel, AutoModelForMaskedLM, AutoTokenizer,
15
+ pipeline)
16
 
17
 
 
 
 
 
 
 
 
 
18
  @asynccontextmanager
19
  async def lifespan(app: FastAPI):
20
  dense_model_name = "sentence-transformers/all-MiniLM-L6-v2"
 
28
  sparse_model = AutoModelForMaskedLM.from_pretrained(sparse_model_name)
29
 
30
  qa_pipeline = pipeline("question-answering", model=qa_model_name)
 
31
 
32
  yield {
33
  "dense_tokenizer": dense_tokenizer,
Api/app/qdrant.py CHANGED
@@ -1,13 +1,10 @@
1
  import os
2
 
3
- from dotenv import load_dotenv
4
- from qdrant_client import QdrantClient, models
5
-
6
  from app.service.api import baseURL
 
7
 
8
- load_dotenv()
9
 
10
- api_key = os.getenv("QDRANT_API_KEY")
11
 
12
  class QdrantConnectionDb:
13
  client = None
 
1
  import os
2
 
 
 
 
3
  from app.service.api import baseURL
4
+ from qdrant_client import QdrantClient, models
5
 
6
+ api_key = os.environ.get("QDRANT_API_KEY")
7
 
 
8
 
9
  class QdrantConnectionDb:
10
  client = None