Vlad Bastina commited on
Commit
c5e1c7f
·
1 Parent(s): 51ba3f9

default image change

Browse files
Files changed (5) hide show
  1. .gitattributes +4 -0
  2. app.py +10 -7
  3. image.jpg +0 -0
  4. photo_ocr.jpg +3 -0
  5. 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 = 'image.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,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.markdown("# Extracted 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
-
67
- st.markdown("# Corrected version")
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.text_area("Extracted Text", extracted_text, height=200)
 
87
 
 
88
  with st.spinner("Correcting text..."):
89
  corrected_text = ai_corrector.correct_output(extracted_text)
90
- st.text_area("Corrected Text", corrected_text, height=200)
 
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

  • SHA256: 26061250558689df6473ef6f9b0e3da013797bab429384a6b9166f9af09de37e
  • Pointer size: 131 Bytes
  • Size of remote file: 175 kB
zega_logo.PNG CHANGED

Git LFS Details

  • SHA256: ab929904c4eadf8cc1aadc9a797a469f20d31a5636770f1db2789f2096033558
  • Pointer size: 131 Bytes
  • Size of remote file: 116 kB