se0kcess commited on
Commit
950d69e
ยท
1 Parent(s): 93090c0
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -24,16 +24,17 @@ def get_pdf_text(pdf_docs):
24
 
25
  # ๊ณผ์ œ
26
  # ์•„๋ž˜ ํ…์ŠคํŠธ ์ถ”์ถœ ํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑ
27
- import os
28
- import tempfile
29
-
30
  def get_text_file(txt_docs):
31
  temp_dir = tempfile.TemporaryDirectory()
32
  temp_filepath = os.path.join(temp_dir.name, txt_docs.name)
 
33
  with open(temp_filepath, "w", encoding="utf-8") as f:
34
  f.write(txt_docs.getvalue())
 
35
  txt_loader = TextLoader(temp_filepath)
36
- return txt_loader
 
 
37
 
38
  # CSV ํŒŒ์ผ๋กœ๋ถ€ํ„ฐ ํ…์ŠคํŠธ๋ฅผ ์ถ”์ถœํ•˜๋Š” ํ•จ์ˆ˜
39
  def get_csv_file(docs):
 
24
 
25
  # ๊ณผ์ œ
26
  # ์•„๋ž˜ ํ…์ŠคํŠธ ์ถ”์ถœ ํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑ
 
 
 
27
  def get_text_file(txt_docs):
28
  temp_dir = tempfile.TemporaryDirectory()
29
  temp_filepath = os.path.join(temp_dir.name, txt_docs.name)
30
+
31
  with open(temp_filepath, "w", encoding="utf-8") as f:
32
  f.write(txt_docs.getvalue())
33
+
34
  txt_loader = TextLoader(temp_filepath)
35
+ txt_doc = txt_loader.load()
36
+
37
+ return txt_doc
38
 
39
  # CSV ํŒŒ์ผ๋กœ๋ถ€ํ„ฐ ํ…์ŠคํŠธ๋ฅผ ์ถ”์ถœํ•˜๋Š” ํ•จ์ˆ˜
40
  def get_csv_file(docs):