Spaces:
Sleeping
Sleeping
DEBUG: download
Browse files
src/components/extractPdfDetails.py
CHANGED
|
@@ -32,7 +32,7 @@ class ExtractPdfDetails:
|
|
| 32 |
images = convert_from_bytes(pdfBytes)
|
| 33 |
return images
|
| 34 |
except Exception as e:
|
| 35 |
-
logger.
|
| 36 |
return None
|
| 37 |
|
| 38 |
def chunkImages(self, images: list[Image.Image]) -> list[list[Image.Image]]:
|
|
@@ -50,7 +50,7 @@ class ExtractPdfDetails:
|
|
| 50 |
chunks = [images[batchSize * x: batchSize * x + batchSize] for x in range(nBatches)]
|
| 51 |
return chunks
|
| 52 |
except Exception as e:
|
| 53 |
-
logger.
|
| 54 |
return None
|
| 55 |
|
| 56 |
def extractDetailsFromChunk(self, images: list[Image.Image]) -> str:
|
|
@@ -76,5 +76,5 @@ class ExtractPdfDetails:
|
|
| 76 |
response = completion.choices[0].message.content
|
| 77 |
return response
|
| 78 |
except Exception as e:
|
| 79 |
-
logger.
|
| 80 |
return None
|
|
|
|
| 32 |
images = convert_from_bytes(pdfBytes)
|
| 33 |
return images
|
| 34 |
except Exception as e:
|
| 35 |
+
logger.exception(f"Error converting pdf to images: {e}")
|
| 36 |
return None
|
| 37 |
|
| 38 |
def chunkImages(self, images: list[Image.Image]) -> list[list[Image.Image]]:
|
|
|
|
| 50 |
chunks = [images[batchSize * x: batchSize * x + batchSize] for x in range(nBatches)]
|
| 51 |
return chunks
|
| 52 |
except Exception as e:
|
| 53 |
+
logger.exception(f"Error chunking the images: {e}")
|
| 54 |
return None
|
| 55 |
|
| 56 |
def extractDetailsFromChunk(self, images: list[Image.Image]) -> str:
|
|
|
|
| 76 |
response = completion.choices[0].message.content
|
| 77 |
return response
|
| 78 |
except Exception as e:
|
| 79 |
+
logger.exception(f"Error extracting details from the images: {e}")
|
| 80 |
return None
|
src/components/summaryEngine.py
CHANGED
|
@@ -35,5 +35,5 @@ class SummaryEngine:
|
|
| 35 |
logger.info("Summary generated successfully")
|
| 36 |
return response
|
| 37 |
except Exception as e:
|
| 38 |
-
logger.
|
| 39 |
return None
|
|
|
|
| 35 |
logger.info("Summary generated successfully")
|
| 36 |
return response
|
| 37 |
except Exception as e:
|
| 38 |
+
logger.exception(f"Error summarizing the text: {e}")
|
| 39 |
return None
|
src/pipelines/pipeline.py
CHANGED
|
@@ -27,5 +27,5 @@ class Pipeline:
|
|
| 27 |
summary = self.summaryEngine.summarize(texts = summaries)
|
| 28 |
return summary
|
| 29 |
except Exception as e:
|
| 30 |
-
logger.
|
| 31 |
return None
|
|
|
|
| 27 |
summary = self.summaryEngine.summarize(texts = summaries)
|
| 28 |
return summary
|
| 29 |
except Exception as e:
|
| 30 |
+
logger.exception(f"Error running the pipeline: {e}")
|
| 31 |
return None
|