Spaces:
Running
Running
Update main.py
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|