Hammad712 commited on
Commit
fb4c874
·
verified ·
1 Parent(s): a868e74

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +11 -1
main.py CHANGED
@@ -37,7 +37,17 @@ def extract_text_from_image(img):
37
  response = client.models.generate_content(
38
  model="gemini-2.0-flash",
39
  contents=[
40
- "Extract the text from the image. Preserve the original formatting exactly as it appears, including line breaks, spacing, and indentation. Do not write anything except the extracted content.", img,
 
 
 
 
 
 
 
 
 
 
41
  ]
42
  )
43
  return response.text
 
37
  response = client.models.generate_content(
38
  model="gemini-2.0-flash",
39
  contents=[
40
+ """Extract all visible text from this image and preserve the original layout and formatting as accurately as possible.
41
+
42
+ - Maintain line breaks, indentation, and paragraph spacing.
43
+ - Do not merge or reflow text from multiple lines into a single line.
44
+ - Preserve bullet points, numbering, punctuation, and symbols exactly as shown.
45
+ - Reproduce alignment (left/center/right) where possible.
46
+ - For tabular or columnar data, preserve column spacing and structure.
47
+ - Do not summarize or interpret the content. Just return the raw extracted text exactly as it appears in the image.
48
+
49
+ Return only the extracted content. Do not add explanations, headers, or any additional comments.""",
50
+ img,
51
  ]
52
  )
53
  return response.text