Spaces:
Runtime error
Runtime error
Added get_csv_file_name method (#4)
Browse files- Added get_csv_file_name method (a34a947415824a54dabef6c8fed79dc1180d9051)
Co-authored-by: Disha Verma <dishav2@users.noreply.huggingface.co>
utils.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import os
|
2 |
import shutil
|
3 |
import time
|
|
|
4 |
|
5 |
from langchain import FAISS
|
6 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
@@ -75,3 +76,12 @@ def get_csv_files(csv_file, source_column, field_names=None):
|
|
75 |
def index_exists(pickle_file, index_file):
|
76 |
return os.path.isfile(pickle_file) and os.path.isfile(index_file) and os.path.getsize(
|
77 |
pickle_file) > 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import os
|
2 |
import shutil
|
3 |
import time
|
4 |
+
import glob
|
5 |
|
6 |
from langchain import FAISS
|
7 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
|
|
76 |
def index_exists(pickle_file, index_file):
|
77 |
return os.path.isfile(pickle_file) and os.path.isfile(index_file) and os.path.getsize(
|
78 |
pickle_file) > 0
|
79 |
+
|
80 |
+
|
81 |
+
def get_csv_file_name():
|
82 |
+
output_dir = 'output'
|
83 |
+
if os.path.exists(output_dir):
|
84 |
+
csv_files = glob.glob(os.path.join(output_dir, '*.csv'))
|
85 |
+
if csv_files:
|
86 |
+
return csv_files[0] # return the first csv file found
|
87 |
+
return None
|