Update app.py
Browse files
app.py
CHANGED
|
@@ -40,12 +40,12 @@ def get_text_file(text_docs):
|
|
| 40 |
|
| 41 |
def get_csv_file(csv_docs):
|
| 42 |
temp_dir = tempfile.TemporaryDirectory() # 임시 디렉토리를 생성합니다.
|
| 43 |
-
temp_filepath = os.path.join(temp_dir.name,
|
| 44 |
with open(temp_filepath, "wb") as f: # 임시 파일을 바이너리 쓰기 모드로 엽니다.
|
| 45 |
-
f.write(
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
return
|
| 49 |
|
| 50 |
def get_json_file(json_docs):
|
| 51 |
temp_dir = tempfile.TemporaryDirectory() # 임시 디렉토리를 생성합니다.
|
|
|
|
| 40 |
|
| 41 |
def get_csv_file(csv_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()) # CSV 문서의 내용을 임시 파일에 씁니다.
|
| 46 |
+
csv_loader = CSVLoader(temp_filepath, source_column="Team") # CSVLoader를 사용해 CSV를 로드합니다.
|
| 47 |
+
csv_doc = csv_loader.load() # 텍스트를 추출합니다.
|
| 48 |
+
return csv_doc # 추출한 텍스트를 반환합니다.
|
| 49 |
|
| 50 |
def get_json_file(json_docs):
|
| 51 |
temp_dir = tempfile.TemporaryDirectory() # 임시 디렉토리를 생성합니다.
|