Rauhan commited on
Commit
8f4f425
1 Parent(s): 6cb1882

UPDATE: New Endpoints

Browse files
Files changed (2) hide show
  1. app.py +1 -0
  2. functions.py +1 -2
app.py CHANGED
@@ -81,6 +81,7 @@ async def addPDFData(vectorstore: str, pdf: UploadFile = File(...)):
81
  }
82
 
83
 
 
84
  @app.post("/addText")
85
  async def addText(vectorstore: str, text: str):
86
  username, chatbotname = vectorstore.split("-")[1], vectorstore.split("-")[2]
 
81
  }
82
 
83
 
84
+
85
  @app.post("/addText")
86
  async def addText(vectorstore: str, text: str):
87
  username, chatbotname = vectorstore.split("-")[1], vectorstore.split("-")[2]
functions.py CHANGED
@@ -40,7 +40,6 @@ vectorEmbeddings = HuggingFaceEmbeddings(
40
  model_kwargs = model_kwargs,
41
  encode_kwargs = encode_kwargs
42
  )
43
- reader = easyocr.Reader(['ch_sim','en'], gpu = True)
44
  sparseEmbeddings = FastEmbedSparse(model = "Qdrant/BM25")
45
  prompt = """
46
  INSTRUCTIONS:
@@ -290,7 +289,7 @@ def getLinks(url: str, timeout = 30):
290
 
291
 
292
  def getTextFromImagePDF(pdfBytes):
293
- global reader
294
  allImages = convert_from_bytes(pdfBytes)
295
  allImages = [np.array(image) for image in allImages]
296
  text = "\n\n\n".join(["\n".join([text[1] for text in reader.readtext(image, paragraph=True)]) for image in allImages])
 
40
  model_kwargs = model_kwargs,
41
  encode_kwargs = encode_kwargs
42
  )
 
43
  sparseEmbeddings = FastEmbedSparse(model = "Qdrant/BM25")
44
  prompt = """
45
  INSTRUCTIONS:
 
289
 
290
 
291
  def getTextFromImagePDF(pdfBytes):
292
+ reader = easyocr.Reader(['ch_sim','en'], gpu = True)
293
  allImages = convert_from_bytes(pdfBytes)
294
  allImages = [np.array(image) for image in allImages]
295
  text = "\n\n\n".join(["\n".join([text[1] for text in reader.readtext(image, paragraph=True)]) for image in allImages])