Skip to content

Commit c88b5d5

Browse files
committed
Fix content read issue
1 parent 75b159d commit c88b5d5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

app/backend/prepdocslib/pdfparser.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ async def parse(self, content: IO) -> AsyncGenerator[Page, None]:
6868
async with DocumentIntelligenceClient(
6969
endpoint=self.endpoint, credential=self.credential
7070
) as document_intelligence_client:
71-
# turn content into bytes
72-
content_bytes = content.read()
7371
if self.use_content_understanding:
7472
if self.content_understanding_endpoint is None:
7573
raise ValueError("Content Understanding is enabled but no endpoint was provided")
@@ -78,6 +76,7 @@ async def parse(self, content: IO) -> AsyncGenerator[Page, None]:
7876
"AzureKeyCredential is not supported for Content Understanding, use keyless auth instead"
7977
)
8078
cu_describer = ContentUnderstandingDescriber(self.content_understanding_endpoint, self.credential)
79+
content_bytes = content.read()
8180
poller = await document_intelligence_client.begin_analyze_document(
8281
model_id="prebuilt-layout",
8382
analyze_request=AnalyzeDocumentRequest(bytes_source=content_bytes),

0 commit comments

Comments
 (0)