Essa20001 commited on
Commit
0a6cf8d
·
verified ·
1 Parent(s): 2a6c54f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -2,6 +2,8 @@ import streamlit as st
2
  from yolo_text_extraction import extract_text_from_sections, cv_to_json
3
  import json
4
  import subprocess
 
 
5
 
6
  def main():
7
 
@@ -13,10 +15,11 @@ def main():
13
  if uploaded_file is not None:
14
  if st.button("Convert to JSON"):
15
  try:
16
- file_bytes = uploaded_file.read()
17
 
18
- # Pass the bytes to cv_to_json
19
- result = cv_to_json(file_bytes)
 
 
20
  st.json(result)
21
 
22
  # Option to download the JSON
 
2
  from yolo_text_extraction import extract_text_from_sections, cv_to_json
3
  import json
4
  import subprocess
5
+ import io
6
+
7
 
8
  def main():
9
 
 
15
  if uploaded_file is not None:
16
  if st.button("Convert to JSON"):
17
  try:
 
18
 
19
+ file_like_object = io.BytesIO(uploaded_file.read())
20
+
21
+ # Pass the file-like object to cv_to_json
22
+ result = cv_to_json(file_like_object)
23
  st.json(result)
24
 
25
  # Option to download the JSON