Commit
Β·
64515bb
1
Parent(s):
9923ac4
Update app.py
Browse files
app.py
CHANGED
@@ -34,7 +34,8 @@ def get_text_file(docs):
|
|
34 |
# .txt νμΌ μ²λ¦¬ ν¨μ
|
35 |
def process_txt_file(file):
|
36 |
filename = file.name.lower() # νμΌ μ΄λ¦μ μλ¬Έμλ‘ λ³ννμ¬ νμ₯μλ₯Ό νμΈν©λλ€.
|
37 |
-
|
|
|
38 |
text = file.getvalue().decode("utf-8")
|
39 |
text_list.append(text)
|
40 |
|
@@ -43,13 +44,11 @@ def get_text_file(docs):
|
|
43 |
process_txt_file(doc) # .txt νμΌ μ²λ¦¬ ν¨μ νΈμΆ
|
44 |
|
45 |
# λ€λ₯Έ νμΌ μ ν(PDF, CSV, JSON λ±)μ λν μ²λ¦¬
|
46 |
-
#
|
47 |
|
48 |
return text_list
|
49 |
|
50 |
|
51 |
-
|
52 |
-
|
53 |
def get_csv_file(docs):
|
54 |
text_list = []
|
55 |
for doc in docs:
|
|
|
34 |
# .txt νμΌ μ²λ¦¬ ν¨μ
|
35 |
def process_txt_file(file):
|
36 |
filename = file.name.lower() # νμΌ μ΄λ¦μ μλ¬Έμλ‘ λ³ννμ¬ νμ₯μλ₯Ό νμΈν©λλ€.
|
37 |
+
file_extension = filename.split('.')[-1] # νμΌ μ΄λ¦μμ νμ₯μ μΆμΆ
|
38 |
+
if file_extension == 'txt': # μΆμΆν νμ₯μκ° 'txt'μΈμ§ νμΈ
|
39 |
text = file.getvalue().decode("utf-8")
|
40 |
text_list.append(text)
|
41 |
|
|
|
44 |
process_txt_file(doc) # .txt νμΌ μ²λ¦¬ ν¨μ νΈμΆ
|
45 |
|
46 |
# λ€λ₯Έ νμΌ μ ν(PDF, CSV, JSON λ±)μ λν μ²λ¦¬
|
47 |
+
# νμνλ€λ©΄ μ¬κΈ°μ μΆκ°μ μΈ νμΌ μ²λ¦¬ λ‘μ§μ ꡬνν©λλ€.
|
48 |
|
49 |
return text_list
|
50 |
|
51 |
|
|
|
|
|
52 |
def get_csv_file(docs):
|
53 |
text_list = []
|
54 |
for doc in docs:
|