Spaces:
Runtime error
Runtime error
se0kcess commited on
Commit ยท
93090c0
1
Parent(s): 8ccd0bd
"update get_text_file"
Browse files23 unmodified lines24252627282930313233343523 unmodified lines# ๊ณผ์ # ์๋ ํ ์คํธ ์ถ์ถ ํจ์๋ฅผ ์์ฑdef get_text_file(txt_docs):with open(txt_docs, 'r', encoding='utf-8') as file:text_content = file.read()txt_loader = TextLoader(text_content)txt_doc = txt_loader.load()return txt_doc# CSV ํ์ผ๋ก๋ถํฐ ํ ์คํธ๋ฅผ ์ถ์ถํ๋ ํจ์def get_csv_file(docs):23 unmodified lines2425262728293031323334353637383923 unmodified lines# ๊ณผ์ # ์๋ ํ ์คํธ ์ถ์ถ ํจ์๋ฅผ ์์ฑimport osimport tempfiledef get_text_file(txt_docs):temp_dir = tempfile.TemporaryDirectory()temp_filepath = os.path.join(temp_dir.name, txt_docs.name)with open(temp_filepath, "w", encoding="utf-8") as f:f.write(txt_docs.getvalue())txt_loader = TextLoader(temp_filepath)return txt_loader# CSV ํ์ผ๋ก๋ถํฐ ํ ์คํธ๋ฅผ ์ถ์ถํ๋ ํจ์def get_csv_file(docs):
app.py+9-5