nguyen-brat commited on
Commit
6d036be
1 Parent(s): 43a3b0d
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -6,6 +6,7 @@ import zipfile
6
  import io
7
  import shutil
8
  import time
 
9
 
10
  def run_bash_script(input_image_path, output_path, progress_placeholder, status_text):
11
  bash_command = f"bash config/text_detection.sh -s {input_image_path} -t {output_path}"
@@ -67,8 +68,9 @@ if uploaded_file is not None:
67
  # os.makedirs(osp(output_path, "mask"), exist_ok=True)
68
 
69
  input_file_path = os.path.join(input_path, uploaded_file.name)
70
- with open(input_file_path, "wb") as f:
71
- f.write(uploaded_file.getbuffer())
 
72
 
73
  if st.button("Run Text Detection"):
74
  progress_placeholder = st.empty()
 
6
  import io
7
  import shutil
8
  import time
9
+ from PIL import Image
10
 
11
  def run_bash_script(input_image_path, output_path, progress_placeholder, status_text):
12
  bash_command = f"bash config/text_detection.sh -s {input_image_path} -t {output_path}"
 
68
  # os.makedirs(osp(output_path, "mask"), exist_ok=True)
69
 
70
  input_file_path = os.path.join(input_path, uploaded_file.name)
71
+ image_data = uploaded_file.getvalue()
72
+ image = Image.open(image_data)
73
+ image.save(input_file_path)
74
 
75
  if st.button("Run Text Detection"):
76
  progress_placeholder = st.empty()