DDingcheol commited on
Commit
e0f22a9
ยท
1 Parent(s): 7368387

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -33,7 +33,17 @@ def get_text_file(docs):
33
  text = extract_text_from_file(file)
34
  if text:
35
  text_list.append(text)
36
- return text_list
 
 
 
 
 
 
 
 
 
 
37
 
38
 
39
  def get_csv_file(docs):
 
33
  text = extract_text_from_file(file)
34
  if text:
35
  text_list.append(text)
36
+ try:
37
+ if file.type == 'text/plain':
38
+ # ํŒŒ์ผ์ด .txt์ธ ๊ฒฝ์šฐ
39
+ text = file.read().decode("utf-8") # ํŒŒ์ผ ๋‚ด์šฉ์„ utf-8 ํ˜•์‹์œผ๋กœ ๋””์ฝ”๋”ฉํ•˜์—ฌ ํ…์ŠคํŠธ๋กœ ๋ณ€ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
40
+ return text
41
+ else:
42
+ # ํŒŒ์ผ์ด .txt๊ฐ€ ์•„๋‹Œ ๊ฒฝ์šฐ ์ฒ˜๋ฆฌ
43
+ return None
44
+ except Exception as e:
45
+ print(f"An error occurred while extracting text: {e}")
46
+ return None
47
 
48
 
49
  def get_csv_file(docs):