han-byeol commited on
Commit
d46cd14
ยท
1 Parent(s): a88a376

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -28,11 +28,11 @@ def get_pdf_text(pdf_docs):
28
  # ๊ณผ์ œ
29
  # ์•„๋ž˜ ํ…์ŠคํŠธ ์ถ”์ถœ ํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑ
30
  # txt ๋ฌธ์„œ๋กœ๋ถ€ํ„ฐ ํ…์ŠคํŠธ๋ฅผ ์ถ”์ถœํ•˜๋Š” ํ•จ์ˆ˜
31
- def get_text_file(file):
32
  temp_dir = tempfile.TemporaryDirectory()
33
- temp_filepath = os.path.join(temp_dir.name, file.name)
34
  with open(temp_filepath, "wb") as f:
35
- f.write(file.getvalue())
36
  text_loader = TextLoader(temp_filepath)
37
  text_doc = text_loader.load()
38
  return text_doc
 
28
  # ๊ณผ์ œ
29
  # ์•„๋ž˜ ํ…์ŠคํŠธ ์ถ”์ถœ ํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑ
30
  # txt ๋ฌธ์„œ๋กœ๋ถ€ํ„ฐ ํ…์ŠคํŠธ๋ฅผ ์ถ”์ถœํ•˜๋Š” ํ•จ์ˆ˜
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())
36
  text_loader = TextLoader(temp_filepath)
37
  text_doc = text_loader.load()
38
  return text_doc