Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +12 -15
src/streamlit_app.py
CHANGED
|
@@ -37,27 +37,24 @@ def get_pdf_text(pdf_docs):
|
|
| 37 |
return pdf_doc # ์ถ์ถํ ํ
์คํธ๋ฅผ ๋ฐํํฉ๋๋ค.
|
| 38 |
|
| 39 |
|
| 40 |
-
#txt ํ์ผ๋ก๋ถํฐ text ์ถ์ถ
|
| 41 |
def get_text_file(txt_docs):
|
| 42 |
-
temp_dir = tempfile.TemporaryDirectory()
|
| 43 |
temp_filepath = os.path.join(temp_dir.name, txt_docs.name)
|
| 44 |
-
with open(temp_filepath, "wb") as f:
|
| 45 |
-
f.write(txt_docs.getvalue())
|
| 46 |
-
text_loader = TextLoader(temp_filepath)
|
| 47 |
-
text_doc =
|
| 48 |
return text_doc
|
| 49 |
|
| 50 |
-
#csv ํ์ผ๋ก๋ถํฐ text ์ถ์ถ
|
| 51 |
def get_csv_file(csv_docs):
|
| 52 |
-
temp_dir = tempfile.TemporaryDirectory()
|
| 53 |
temp_filepath = os.path.join(temp_dir.name, csv_docs.name)
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
csv_loader = CSVLoader(temp_filepath) # CSVLoader๋ฅผ ์ฌ์ฉํด ๋ก๋ํฉ๋๋ค.
|
| 59 |
-
csv_doc = csv_loader.load() # ํ
์คํธ๋ฅผ ์ถ์ถํฉ๋๋ค.
|
| 60 |
-
|
| 61 |
return csv_doc
|
| 62 |
|
| 63 |
# def get_json_file(docs):
|
|
|
|
| 37 |
return pdf_doc # ์ถ์ถํ ํ
์คํธ๋ฅผ ๋ฐํํฉ๋๋ค.
|
| 38 |
|
| 39 |
|
| 40 |
+
# txt ํ์ผ๋ก๋ถํฐ text ์ถ์ถ
|
| 41 |
def get_text_file(txt_docs):
|
| 42 |
+
temp_dir = tempfile.TemporaryDirectory()
|
| 43 |
temp_filepath = os.path.join(temp_dir.name, txt_docs.name)
|
| 44 |
+
with open(temp_filepath, "wb") as f:
|
| 45 |
+
f.write(txt_docs.getvalue())
|
| 46 |
+
text_loader = TextLoader(temp_filepath)
|
| 47 |
+
text_doc = text_loader.load()
|
| 48 |
return text_doc
|
| 49 |
|
| 50 |
+
# csv ํ์ผ๋ก๋ถํฐ text ์ถ์ถ
|
| 51 |
def get_csv_file(csv_docs):
|
| 52 |
+
temp_dir = tempfile.TemporaryDirectory()
|
| 53 |
temp_filepath = os.path.join(temp_dir.name, csv_docs.name)
|
| 54 |
+
with open(temp_filepath, "wb") as f:
|
| 55 |
+
f.write(csv_docs.getvalue())
|
| 56 |
+
csv_loader = CSVLoader(temp_filepath)
|
| 57 |
+
csv_doc = csv_loader.load()
|
|
|
|
|
|
|
|
|
|
| 58 |
return csv_doc
|
| 59 |
|
| 60 |
# def get_json_file(docs):
|