Commit
ยท
e0f22a9
1
Parent(s):
7368387
Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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):
|