Update app.py
#6
by
MyeongGyun
- opened
app.py
CHANGED
|
@@ -29,14 +29,27 @@ def get_pdf_text(pdf_docs):
|
|
| 29 |
# μλ ν
μ€νΈ μΆμΆ ν¨μλ₯Ό μμ±
|
| 30 |
|
| 31 |
def get_text_file(docs):
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
def get_csv_file(docs):
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
def get_json_file(docs):
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
|
| 42 |
# λ¬Έμλ€μ μ²λ¦¬νμ¬ ν
μ€νΈ μ²ν¬λ‘ λλλ ν¨μμ
λλ€.
|
|
|
|
| 29 |
# μλ ν
μ€νΈ μΆμΆ ν¨μλ₯Ό μμ±
|
| 30 |
|
| 31 |
def get_text_file(docs):
|
| 32 |
+
if docs.type == 'text/plain':
|
| 33 |
+
text = docs.getvalue().decode("utf-8")
|
| 34 |
+
return [text]
|
| 35 |
+
else:
|
| 36 |
+
return []
|
| 37 |
|
| 38 |
def get_csv_file(docs):
|
| 39 |
+
if docs.type == 'text/csv':
|
| 40 |
+
csv_text = docs.getvalue().decode("utf-8")
|
| 41 |
+
|
| 42 |
+
return csv_text.splitlines()
|
| 43 |
+
else:
|
| 44 |
+
return []
|
| 45 |
|
| 46 |
def get_json_file(docs):
|
| 47 |
+
if docs.type == 'application/json':
|
| 48 |
+
json_text = docs.getvalue().decode("utf-8")
|
| 49 |
+
|
| 50 |
+
return [json_text]
|
| 51 |
+
else:
|
| 52 |
+
return []
|
| 53 |
|
| 54 |
|
| 55 |
# λ¬Έμλ€μ μ²λ¦¬νμ¬ ν
μ€νΈ μ²ν¬λ‘ λλλ ν¨μμ
λλ€.
|