Update app.py
Browse files
app.py
CHANGED
@@ -39,7 +39,6 @@ class PDFTextExtractor:
|
|
39 |
"content": """You are an expert in document processing and OCR with deep knowledge of Markdown formatting.
|
40 |
Extract the Patient Admission Form (KMHIPF002V3) from this image and format it in clean markdown.
|
41 |
Follow this exact markdown structure:
|
42 |
-
|
43 |
# PATIENT ADMISSION FORM
|
44 |
## DR.KAMAKSHI MEMORIAL HOSPITAL, PALLIKARANAI, CHENNAI.
|
45 |
|
@@ -145,10 +144,10 @@ class PDFTextExtractor:
|
|
145 |
max_tokens=4096
|
146 |
)
|
147 |
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
|
153 |
return extracted_texts
|
154 |
|
@@ -183,4 +182,4 @@ iface = gr.Interface(
|
|
183 |
description="Upload a PDF file to extract all text using OpenAI's GPT-4 Vision."
|
184 |
)
|
185 |
|
186 |
-
iface.launch()
|
|
|
39 |
"content": """You are an expert in document processing and OCR with deep knowledge of Markdown formatting.
|
40 |
Extract the Patient Admission Form (KMHIPF002V3) from this image and format it in clean markdown.
|
41 |
Follow this exact markdown structure:
|
|
|
42 |
# PATIENT ADMISSION FORM
|
43 |
## DR.KAMAKSHI MEMORIAL HOSPITAL, PALLIKARANAI, CHENNAI.
|
44 |
|
|
|
144 |
max_tokens=4096
|
145 |
)
|
146 |
|
147 |
+
extracted_texts.append({
|
148 |
+
'page': i + 1,
|
149 |
+
'text': response.choices[0].message.content
|
150 |
+
})
|
151 |
|
152 |
return extracted_texts
|
153 |
|
|
|
182 |
description="Upload a PDF file to extract all text using OpenAI's GPT-4 Vision."
|
183 |
)
|
184 |
|
185 |
+
iface.launch()
|