DDingcheol commited on
Commit
ef30a5d
ยท
1 Parent(s): bfe1ead

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -13
app.py CHANGED
@@ -27,19 +27,10 @@ def get_pdf_text(pdf_docs):
27
  # ์•„๋ž˜ ํ…์ŠคํŠธ ์ถ”์ถœ ํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑ
28
  def get_text_file(docs):
29
  text_list = []
30
- for file in docs:
31
- try:
32
- filename = file.name
33
- file_extension = filename.split(".")[-1].lower() # ํŒŒ์ผ ์ด๋ฆ„์—์„œ ํ™•์žฅ์ž ์ถ”์ถœํ•˜์—ฌ ์†Œ๋ฌธ์ž๋กœ ๋ณ€ํ™˜
34
-
35
- if file_extension == 'txt':
36
- # ํŒŒ์ผ์ด .txt์ธ ๊ฒฝ์šฐ
37
- text = file.getvalue().decode("utf-8") # ํŒŒ์ผ ๋‚ด์šฉ์„ utf-8 ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉํ•˜์—ฌ ํ…์ŠคํŠธ๋กœ ๋ณ€ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
38
- text_list.append(text)
39
- else:
40
- print(f"Unsupported file type: {file_extension}. Skipping processing.")
41
- except Exception as e:
42
- print(f"An error occurred while processing the file: {e}")
43
 
44
  return text_list
45
 
 
27
  # ์•„๋ž˜ ํ…์ŠคํŠธ ์ถ”์ถœ ํ•จ์ˆ˜๋ฅผ ์ž‘์„ฑ
28
  def get_text_file(docs):
29
  text_list = []
30
+ for doc in docs:
31
+ text = doc.getvalue().decode('utf-8')
32
+ text_list.append(text)
33
+ return text_list
 
 
 
 
 
 
 
 
 
34
 
35
  return text_list
36