Spaces:
Runtime error
Runtime error
se0kcess
commited on
Commit
ยท
8ccd0bd
1
Parent(s):
3b6702c
"update text"
Browse files
app.py
CHANGED
|
@@ -25,31 +25,23 @@ def get_pdf_text(pdf_docs):
|
|
| 25 |
# ๊ณผ์
|
| 26 |
# ์๋ ํ
์คํธ ์ถ์ถ ํจ์๋ฅผ ์์ฑ
|
| 27 |
def get_text_file(txt_docs):
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
def get_json_file(json_docs):
|
| 46 |
-
temp_dir = tempfile.TemporaryDirectory()
|
| 47 |
-
temp_filepath = os.path.join(temp_dir.name, json_docs.name)
|
| 48 |
-
with open(temp_filepath, "w", encoding="utf-8") as j:
|
| 49 |
-
j.write(json_docs.getvalue())
|
| 50 |
-
json_loader = JSONLoader(temp_filepath)
|
| 51 |
-
json_doc = json_loader.load()
|
| 52 |
-
return json_doc
|
| 53 |
|
| 54 |
# ๋ฌธ์๋ค์ ์ฒ๋ฆฌํ์ฌ ํ
์คํธ ์ฒญํฌ๋ก ๋๋๋ ํจ์์
๋๋ค.
|
| 55 |
def get_text_chunks(documents):
|
|
|
|
| 25 |
# ๊ณผ์
|
| 26 |
# ์๋ ํ
์คํธ ์ถ์ถ ํจ์๋ฅผ ์์ฑ
|
| 27 |
def get_text_file(txt_docs):
|
| 28 |
+
with open(txt_docs, 'r', encoding='utf-8') as file:
|
| 29 |
+
text_content = file.read()
|
| 30 |
+
txt_loader = TextLoader(text_content)
|
| 31 |
+
txt_doc = txt_loader.load()
|
| 32 |
+
return txt_doc
|
| 33 |
+
|
| 34 |
+
# CSV ํ์ผ๋ก๋ถํฐ ํ
์คํธ๋ฅผ ์ถ์ถํ๋ ํจ์
|
| 35 |
+
def get_csv_file(docs):
|
| 36 |
+
with open(docs, 'r', encoding='utf-8') as file:
|
| 37 |
+
csv_text = file.read()
|
| 38 |
+
return csv_text
|
| 39 |
+
|
| 40 |
+
# JSON ํ์ผ๋ก๋ถํฐ ํ
์คํธ๋ฅผ ์ถ์ถํ๋ ํจ์
|
| 41 |
+
def get_json_file(docs):
|
| 42 |
+
with open(docs, 'r', encoding='utf-8') as file:
|
| 43 |
+
json_text = file.read()
|
| 44 |
+
return json_text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
# ๋ฌธ์๋ค์ ์ฒ๋ฆฌํ์ฌ ํ
์คํธ ์ฒญํฌ๋ก ๋๋๋ ํจ์์
๋๋ค.
|
| 47 |
def get_text_chunks(documents):
|