JinHyeong99 commited on
Commit
946b62f
Β·
1 Parent(s): 131879f
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -31,7 +31,9 @@ def get_pdf_text(pdf_docs):
31
  def get_text_file(text_docs):
32
  temp_dir = tempfile.TemporaryDirectory() # μž„μ‹œ 디렉토리λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
33
  temp_filepath = os.path.join(temp_dir.name, text_docs.name) # μž„μ‹œ 파일 경둜λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
34
- text_loader = TextLoader(text_docs.name)
 
 
35
  text_doc = text_loader.load()
36
  return text_doc
37
 
 
31
  def get_text_file(text_docs):
32
  temp_dir = tempfile.TemporaryDirectory() # μž„μ‹œ 디렉토리λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
33
  temp_filepath = os.path.join(temp_dir.name, text_docs.name) # μž„μ‹œ 파일 경둜λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
34
+ with open(temp_filepath, "wb") as f: # μž„μ‹œ νŒŒμΌμ„ λ°”μ΄λ„ˆλ¦¬ μ“°κΈ° λͺ¨λ“œλ‘œ μ—½λ‹ˆλ‹€.
35
+ f.write(text_docs.getvalue()) # Text λ¬Έμ„œμ˜ λ‚΄μš©μ„ μž„μ‹œ νŒŒμΌμ— μ”λ‹ˆλ‹€.
36
+ text_loader = TextLoader(temp_filepath) # TextLoader μΈμŠ€ν„΄μŠ€λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
37
  text_doc = text_loader.load()
38
  return text_doc
39