Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,12 +40,14 @@ def get_text_file(text_data):
|
|
| 40 |
def get_csv_file(csv_file):
|
| 41 |
temp_dir = tempfile.TemporaryDirectory()
|
| 42 |
temp_filepath = os.path.join(temp_dir.name, csv_file.name)
|
| 43 |
-
with open(temp_filepath, "
|
| 44 |
-
|
| 45 |
-
|
|
|
|
| 46 |
csv_data = csv_loader.load()
|
| 47 |
return csv_data
|
| 48 |
|
|
|
|
| 49 |
def get_json_file(json_datas):
|
| 50 |
temp_dir = tempfile.TemporaryDirectory() # 임시 디렉토리를 생성합니다.
|
| 51 |
temp_filepath = os.path.join(temp_dir.name, json_datas.name) # 임시 JSON 파일 경로를 생성합니다.
|
|
|
|
| 40 |
def get_csv_file(csv_file):
|
| 41 |
temp_dir = tempfile.TemporaryDirectory()
|
| 42 |
temp_filepath = os.path.join(temp_dir.name, csv_file.name)
|
| 43 |
+
with open(temp_filepath, "wb") as f:
|
| 44 |
+
f.write(csv_file.getvalue())
|
| 45 |
+
|
| 46 |
+
csv_loader = CSVLoader(temp_filepath, text_column='text_column_name') # 여기서 'text_column_name'은 실제 CSV 파일의 텍스트가 들어있는 열의 이름입니다.
|
| 47 |
csv_data = csv_loader.load()
|
| 48 |
return csv_data
|
| 49 |
|
| 50 |
+
|
| 51 |
def get_json_file(json_datas):
|
| 52 |
temp_dir = tempfile.TemporaryDirectory() # 임시 디렉토리를 생성합니다.
|
| 53 |
temp_filepath = os.path.join(temp_dir.name, json_datas.name) # 임시 JSON 파일 경로를 생성합니다.
|