sujeongim0402@gmail.com commited on
Commit
5d88956
โ€ข
1 Parent(s): c7ea54b

edit codes

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -43,7 +43,13 @@ def get_pdf_text(pdf_docs):
43
  # text_data = text_loader.load() # Extract text using the loader.
44
  # return text_data # ์ถ”์ถœํ•œ ํ…์ŠคํŠธ๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
45
  def get_text_file(docs):
46
- return [docs.getvalue()]
 
 
 
 
 
 
47
 
48
  def get_csv_file(docs):
49
  temp_dir3 = tempfile.TemporaryDirectory()
 
43
  # text_data = text_loader.load() # Extract text using the loader.
44
  # return text_data # ์ถ”์ถœํ•œ ํ…์ŠคํŠธ๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
45
  def get_text_file(docs):
46
+ temp_dir2 = tempfile.TemporaryDirectory() # ์ž„์‹œ ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
47
+ temp_filepath2 = os.path.join(temp_dir2.name, docs.name) # ์ž„์‹œ ํŒŒ์ผ ๊ฒฝ๋กœ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
48
+ txt_loader = TextLoader(
49
+ file_path=temp_filepath2
50
+ )
51
+ txt_data = txt_loader.load()
52
+ return txt_data
53
 
54
  def get_csv_file(docs):
55
  temp_dir3 = tempfile.TemporaryDirectory()