Update app.py
Browse files
app.py
CHANGED
@@ -28,12 +28,24 @@ def get_pdf_text(pdf_docs):
|
|
28 |
# ๊ณผ์
|
29 |
# ์๋ ํ
์คํธ ์ถ์ถ ํจ์๋ฅผ ์์ฑ
|
30 |
|
31 |
-
def get_text_file(
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
|
35 |
def get_csv_file(docs):
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
def get_json_file(docs):
|
39 |
pass
|
|
|
28 |
# ๊ณผ์
|
29 |
# ์๋ ํ
์คํธ ์ถ์ถ ํจ์๋ฅผ ์์ฑ
|
30 |
|
31 |
+
def get_text_file(text_docs):
|
32 |
+
temp_dir = tempfile.TemporaryDirectory()
|
33 |
+
temp_filepath = os.path.join(temp_dir.name, text_docs.name)
|
34 |
+
with open(temp_filepath, "wb") as f:
|
35 |
+
f.writhe(text_docs.getvalue())
|
36 |
+
text_loader = TextLoader(Temp_filepath)
|
37 |
+
text_doc = text_loader.load()
|
38 |
+
return text_doc
|
39 |
|
40 |
|
41 |
def get_csv_file(docs):
|
42 |
+
temp_dir = tempfile.TemporaryDirectory()
|
43 |
+
temp_filepath = os.path.join(temp_dir.name, csv_docs.name)
|
44 |
+
with open(temp_filepath, "wb") as f:
|
45 |
+
f.write(csv_docs.getvalue())
|
46 |
+
csv_loader = CSVLoader(temp_filepath)
|
47 |
+
csv_doc = csv_loader.load()
|
48 |
+
return csv_doc
|
49 |
|
50 |
def get_json_file(docs):
|
51 |
pass
|