Spaces:
Running
Running
Vlad Bastina commited on
Commit ·
c5e1c7f
1
Parent(s): 51ba3f9
default image change
Browse files- .gitattributes +4 -0
- app.py +10 -7
- image.jpg +0 -0
- photo_ocr.jpg +3 -0
- zega_logo.PNG +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
*.PNG filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
*.docx filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
|
@@ -6,7 +6,7 @@ from gemini_correction import AiCorrection
|
|
| 6 |
from pathlib import Path
|
| 7 |
import os
|
| 8 |
|
| 9 |
-
@st.cache_resource()
|
| 10 |
def load_useful():
|
| 11 |
return PaddleOCR(lang='en', use_angle_cls=False), AiCorrection()
|
| 12 |
|
|
@@ -51,7 +51,7 @@ Then, it sends that text to an AI to clean it up and make it sound better.''')
|
|
| 51 |
|
| 52 |
if use_default_image:
|
| 53 |
# If the user chooses default image, load it from a file
|
| 54 |
-
default_image_path = '
|
| 55 |
image = Image.open(default_image_path)
|
| 56 |
st.image(image, caption="Default Image", use_container_width=True)
|
| 57 |
|
|
@@ -59,12 +59,12 @@ Then, it sends that text to an AI to clean it up and make it sound better.''')
|
|
| 59 |
img_np = np.array(image)
|
| 60 |
result = ocr.ocr(img_np, cls=True)
|
| 61 |
|
| 62 |
-
st.
|
| 63 |
# Display results
|
| 64 |
extracted_text = "\n".join([res[1][0] for line in result for res in line])
|
| 65 |
st.write(extracted_text)
|
| 66 |
-
|
| 67 |
-
st.
|
| 68 |
corrected_text = ai_corrector.correct_output(extracted_text)
|
| 69 |
st.write(corrected_text)
|
| 70 |
|
|
@@ -83,11 +83,14 @@ Then, it sends that text to an AI to clean it up and make it sound better.''')
|
|
| 83 |
|
| 84 |
|
| 85 |
extracted_text = "\n".join([res[1][0] for line in result for res in line])
|
| 86 |
-
st.
|
|
|
|
| 87 |
|
|
|
|
| 88 |
with st.spinner("Correcting text..."):
|
| 89 |
corrected_text = ai_corrector.correct_output(extracted_text)
|
| 90 |
-
st.
|
|
|
|
| 91 |
|
| 92 |
|
| 93 |
if __name__ == "__main__":
|
|
|
|
| 6 |
from pathlib import Path
|
| 7 |
import os
|
| 8 |
|
| 9 |
+
#@st.cache_resource()
|
| 10 |
def load_useful():
|
| 11 |
return PaddleOCR(lang='en', use_angle_cls=False), AiCorrection()
|
| 12 |
|
|
|
|
| 51 |
|
| 52 |
if use_default_image:
|
| 53 |
# If the user chooses default image, load it from a file
|
| 54 |
+
default_image_path = 'photo_ocr.jpg' # Specify the path to your default image
|
| 55 |
image = Image.open(default_image_path)
|
| 56 |
st.image(image, caption="Default Image", use_container_width=True)
|
| 57 |
|
|
|
|
| 59 |
img_np = np.array(image)
|
| 60 |
result = ocr.ocr(img_np, cls=True)
|
| 61 |
|
| 62 |
+
st.header("Raw text")
|
| 63 |
# Display results
|
| 64 |
extracted_text = "\n".join([res[1][0] for line in result for res in line])
|
| 65 |
st.write(extracted_text)
|
| 66 |
+
st.markdown("---")
|
| 67 |
+
st.header("Corrected version")
|
| 68 |
corrected_text = ai_corrector.correct_output(extracted_text)
|
| 69 |
st.write(corrected_text)
|
| 70 |
|
|
|
|
| 83 |
|
| 84 |
|
| 85 |
extracted_text = "\n".join([res[1][0] for line in result for res in line])
|
| 86 |
+
st.header("Raw text")
|
| 87 |
+
st.markdown(extracted_text)
|
| 88 |
|
| 89 |
+
st.markdown("---")
|
| 90 |
with st.spinner("Correcting text..."):
|
| 91 |
corrected_text = ai_corrector.correct_output(extracted_text)
|
| 92 |
+
st.header("Corrected Version")
|
| 93 |
+
st.markdown(corrected_text)
|
| 94 |
|
| 95 |
|
| 96 |
if __name__ == "__main__":
|
image.jpg
DELETED
|
Binary file (200 kB)
|
|
|
photo_ocr.jpg
ADDED
|
Git LFS Details
|
zega_logo.PNG
CHANGED
|
|
|
|
Git LFS Details
|