Commit
Β·
eaa055f
1
Parent(s):
897ec15
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,14 +29,22 @@ 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 |
+
return docs.read()
|
|
|
|
| 33 |
|
| 34 |
def get_csv_file(docs):
|
| 35 |
+
text = ''
|
| 36 |
+
if docs.name.endswith('.csv'):
|
| 37 |
+
reader = csv.reader(docs)
|
| 38 |
+
for row in reader:
|
| 39 |
+
text += ', '.join(row) + '\n'
|
| 40 |
+
return text
|
| 41 |
|
| 42 |
def get_json_file(docs):
|
| 43 |
+
text = ''
|
| 44 |
+
if docs.name.endswith('.json'):
|
| 45 |
+
data = json.load(docs)
|
| 46 |
+
text = json.dumps(data, indent=4)
|
| 47 |
+
return text
|
| 48 |
|
| 49 |
|
| 50 |
# λ¬Έμλ€μ μ²λ¦¬νμ¬ ν
μ€νΈ μ²ν¬λ‘ λλλ ν¨μμ
λλ€.
|