Update app.py
Browse files
app.py
CHANGED
|
@@ -28,11 +28,11 @@ def get_pdf_text(pdf_docs):
|
|
| 28 |
# ๊ณผ์
|
| 29 |
# ์๋ ํ
์คํธ ์ถ์ถ ํจ์๋ฅผ ์์ฑ
|
| 30 |
# .txt ๋ฌธ์๋ก๋ถํฐ ํ
์คํธ๋ฅผ ์ถ์ถํ๋ ํจ์
|
| 31 |
-
def get_text_file(
|
| 32 |
return docs.read().decode('utf-8') #ํ
์คํธ ํ์ผ์ ์ฝ๊ณ UTF-8๋ก ๋์ฝ๋ฉํ์ฌ ๋ฐํ
|
| 33 |
|
| 34 |
# .csv ๋ฌธ์๋ก๋ถํฐ ํ
์คํธ๋ฅผ ์ถ์ถํ๋ ํจ์
|
| 35 |
-
def get_csv_file(
|
| 36 |
csv_text = ""
|
| 37 |
reader = csv.reader(docs)
|
| 38 |
for row in reader:
|
|
@@ -40,7 +40,7 @@ def get_csv_file(docs):
|
|
| 40 |
return csv_text
|
| 41 |
|
| 42 |
# .json ๋ฌธ์๋ก๋ถํฐ ํ
์คํธ๋ฅผ ์ถ์ถํ๋ ํจ์
|
| 43 |
-
def get_json_file(
|
| 44 |
json_data = json.load(docs) # JSON ํ์ผ์ ์ฝ์ด JSON ๋ฐ์ดํฐ๋ก ํ์ฑ
|
| 45 |
return json.dumps(json_data, indent=4) # JSON ๋ฐ์ดํฐ๋ฅผ ๋ฌธ์์ด๋ก ๋ฐํ
|
| 46 |
|
|
|
|
| 28 |
# ๊ณผ์
|
| 29 |
# ์๋ ํ
์คํธ ์ถ์ถ ํจ์๋ฅผ ์์ฑ
|
| 30 |
# .txt ๋ฌธ์๋ก๋ถํฐ ํ
์คํธ๋ฅผ ์ถ์ถํ๋ ํจ์
|
| 31 |
+
def get_text_file(txt_docs):
|
| 32 |
return docs.read().decode('utf-8') #ํ
์คํธ ํ์ผ์ ์ฝ๊ณ UTF-8๋ก ๋์ฝ๋ฉํ์ฌ ๋ฐํ
|
| 33 |
|
| 34 |
# .csv ๋ฌธ์๋ก๋ถํฐ ํ
์คํธ๋ฅผ ์ถ์ถํ๋ ํจ์
|
| 35 |
+
def get_csv_file(csv_docs):
|
| 36 |
csv_text = ""
|
| 37 |
reader = csv.reader(docs)
|
| 38 |
for row in reader:
|
|
|
|
| 40 |
return csv_text
|
| 41 |
|
| 42 |
# .json ๋ฌธ์๋ก๋ถํฐ ํ
์คํธ๋ฅผ ์ถ์ถํ๋ ํจ์
|
| 43 |
+
def get_json_file(json_docs):
|
| 44 |
json_data = json.load(docs) # JSON ํ์ผ์ ์ฝ์ด JSON ๋ฐ์ดํฐ๋ก ํ์ฑ
|
| 45 |
return json.dumps(json_data, indent=4) # JSON ๋ฐ์ดํฐ๋ฅผ ๋ฌธ์์ด๋ก ๋ฐํ
|
| 46 |
|