[email protected] commited on
Commit
8b057ae
Β·
1 Parent(s): b4b9a43

edit codes

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -33,7 +33,14 @@ def get_pdf_text(pdf_docs):
33
  def get_text_file(docs):
34
  temp_dir2 = tempfile.TemporaryDirectory() # μž„μ‹œ 디렉토리λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
35
  temp_filepath2 = os.path.join(temp_dir2.name, docs.name) # μž„μ‹œ 파일 경둜λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
36
- txt_loader = TextLoader(temp_filepath2)
 
 
 
 
 
 
 
37
  txt_data = txt_loader.load()
38
  return txt_data
39
 
 
33
  def get_text_file(docs):
34
  temp_dir2 = tempfile.TemporaryDirectory() # μž„μ‹œ 디렉토리λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
35
  temp_filepath2 = os.path.join(temp_dir2.name, docs.name) # μž„μ‹œ 파일 경둜λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
36
+ with open(temp_filepath2, "wb") as f:
37
+ f.write(docs.getvalue())
38
+ txt_loader = TextLoader(
39
+ file_path=temp_filepath2,
40
+ txt_args={
41
+ 'delimiter': ' '
42
+ }
43
+ )
44
  txt_data = txt_loader.load()
45
  return txt_data
46