Overthrow4232 commited on
Commit
ed93b21
·
verified ·
1 Parent(s): a6de682

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -4,6 +4,7 @@ from wtpsplit import SaT
4
  import json
5
  import zipfile
6
  import io
 
7
 
8
  # Initialize the SaT model
9
  sat = SaT("sat-3l-sm")
@@ -19,7 +20,7 @@ def segment_text(input_text, zip_file):
19
  results["input_text"] = {"segments": sentences}
20
  elif zip_file is not None:
21
  # Process zip file
22
- with zipfile.ZipFile(io.BytesIO(zip_file), 'r') as zip_ref:
23
  for file_name in zip_ref.namelist():
24
  if file_name.endswith('.txt'):
25
  with zip_ref.open(file_name) as file:
 
4
  import json
5
  import zipfile
6
  import io
7
+ import os
8
 
9
  # Initialize the SaT model
10
  sat = SaT("sat-3l-sm")
 
20
  results["input_text"] = {"segments": sentences}
21
  elif zip_file is not None:
22
  # Process zip file
23
+ with zipfile.ZipFile(zip_file.name, 'r') as zip_ref:
24
  for file_name in zip_ref.namelist():
25
  if file_name.endswith('.txt'):
26
  with zip_ref.open(file_name) as file: