Update app.py
Browse files
app.py
CHANGED
@@ -22,39 +22,18 @@ def get_pdf_text(pdf_docs):
|
|
22 |
pdf_doc = pdf_loader.load() # ํ
์คํธ๋ฅผ ์ถ์ถํฉ๋๋ค.
|
23 |
return pdf_doc # ์ถ์ถํ ํ
์คํธ๋ฅผ ๋ฐํํฉ๋๋ค.
|
24 |
|
25 |
-
|
|
|
26 |
def get_text_file(docs):
|
27 |
-
|
28 |
-
|
29 |
-
with open(temp_filepath, "wb") as f:
|
30 |
-
f.write(docs.getvalue())
|
31 |
-
text_loader = TextLoader(temp_filepath)
|
32 |
-
text_doc = text_loader.load()
|
33 |
-
return text_doc
|
34 |
-
|
35 |
-
|
36 |
def get_csv_file(docs):
|
37 |
-
|
38 |
-
temp_filepath = os.path.join(temp_dir.name, docs.name)
|
39 |
-
with open(temp_filepath, "wb") as f:
|
40 |
-
f.write(docs.getvalue())
|
41 |
-
csv_loader = CSVLoader(temp_filepath)
|
42 |
-
csv_doc = csv_loader.load()
|
43 |
-
return csv_doc
|
44 |
|
45 |
def get_json_file(docs):
|
46 |
-
|
47 |
-
temp_filepath = os.path.join(temp_dir.name, docs.name)
|
48 |
-
with open(temp_filepath, "wb") as f:
|
49 |
-
f.write(docs.getvalue())
|
50 |
-
json_loader = JSONLoader(temp_filepath,
|
51 |
-
jq_schema='.scans[].relationships',
|
52 |
-
text_content=False)
|
53 |
-
|
54 |
-
json_doc = json_loader.load()
|
55 |
-
# print('json_doc = ',json_doc)
|
56 |
-
return json_doc
|
57 |
|
|
|
58 |
# ๋ฌธ์๋ค์ ์ฒ๋ฆฌํ์ฌ ํ
์คํธ ์ฒญํฌ๋ก ๋๋๋ ํจ์์
๋๋ค.
|
59 |
def get_text_chunks(documents):
|
60 |
text_splitter = RecursiveCharacterTextSplitter(
|
|
|
22 |
pdf_doc = pdf_loader.load() # ํ
์คํธ๋ฅผ ์ถ์ถํฉ๋๋ค.
|
23 |
return pdf_doc # ์ถ์ถํ ํ
์คํธ๋ฅผ ๋ฐํํฉ๋๋ค.
|
24 |
|
25 |
+
# ๊ณผ์
|
26 |
+
# ์๋ ํ
์คํธ ์ถ์ถ ํจ์๋ฅผ ์์ฑ
|
27 |
def get_text_file(docs):
|
28 |
+
pass
|
29 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
def get_csv_file(docs):
|
31 |
+
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
def get_json_file(docs):
|
34 |
+
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
+
|
37 |
# ๋ฌธ์๋ค์ ์ฒ๋ฆฌํ์ฌ ํ
์คํธ ์ฒญํฌ๋ก ๋๋๋ ํจ์์
๋๋ค.
|
38 |
def get_text_chunks(documents):
|
39 |
text_splitter = RecursiveCharacterTextSplitter(
|