Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -28,7 +28,7 @@ def get_pdf_text(pdf_docs):
|
|
28 |
# 과제
|
29 |
# 아래 텍스트 추출 함수를 작성
|
30 |
|
31 |
-
def get_text_file(
|
32 |
temp_dir2 = tempfile.TemporaryDirectory()
|
33 |
temp_filepath2 = os.path.join(temp_dir2.name, text_docs.name)
|
34 |
with open(temp_filepath2, "wb") as f:
|
@@ -37,7 +37,7 @@ def get_text_file(docs):
|
|
37 |
text_doc = text_loader.load()
|
38 |
return text_doc
|
39 |
|
40 |
-
def get_csv_file(
|
41 |
temp_dir3 = tempfile.TemporaryDirectory() # 임시 디렉토리를 생성합니다.
|
42 |
temp_filepath3 = os.path.join(temp_dir.name, csv_docs.name) # 임시 파일 경로를 생성합니다.
|
43 |
with open(temp_filepath3, "wb") as f: # 임시 파일을 바이너리 쓰기 모드로 엽니다.
|
@@ -46,7 +46,7 @@ def get_csv_file(docs):
|
|
46 |
csv_doc = csv_loader.load() # 텍스트를 추출합니다.
|
47 |
return csv_doc # 추출한 텍스트를 반환합니다.
|
48 |
|
49 |
-
def get_json_file(
|
50 |
temp_dir4 = tempfile.TemporaryDirectory() # 임시 디렉토리를 생성합니다.
|
51 |
temp_filepath4 = os.path.join(temp_dir.name, json_docs.name) # 임시 파일 경로를 생성합니다.
|
52 |
with open(temp_filepath4, "wb") as f: # 임시 파일을 바이너리 쓰기 모드로 엽니다.
|
|
|
28 |
# 과제
|
29 |
# 아래 텍스트 추출 함수를 작성
|
30 |
|
31 |
+
def get_text_file(text_docs):
|
32 |
temp_dir2 = tempfile.TemporaryDirectory()
|
33 |
temp_filepath2 = os.path.join(temp_dir2.name, text_docs.name)
|
34 |
with open(temp_filepath2, "wb") as f:
|
|
|
37 |
text_doc = text_loader.load()
|
38 |
return text_doc
|
39 |
|
40 |
+
def get_csv_file(csv_docs):
|
41 |
temp_dir3 = tempfile.TemporaryDirectory() # 임시 디렉토리를 생성합니다.
|
42 |
temp_filepath3 = os.path.join(temp_dir.name, csv_docs.name) # 임시 파일 경로를 생성합니다.
|
43 |
with open(temp_filepath3, "wb") as f: # 임시 파일을 바이너리 쓰기 모드로 엽니다.
|
|
|
46 |
csv_doc = csv_loader.load() # 텍스트를 추출합니다.
|
47 |
return csv_doc # 추출한 텍스트를 반환합니다.
|
48 |
|
49 |
+
def get_json_file(json_docs):
|
50 |
temp_dir4 = tempfile.TemporaryDirectory() # 임시 디렉토리를 생성합니다.
|
51 |
temp_filepath4 = os.path.join(temp_dir.name, json_docs.name) # 임시 파일 경로를 생성합니다.
|
52 |
with open(temp_filepath4, "wb") as f: # 임시 파일을 바이너리 쓰기 모드로 엽니다.
|