minji1115 commited on
Commit
3269a35
·
1 Parent(s): a686f5b

wb로 변경

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -35,8 +35,8 @@ def get_text_file(text_docs):
35
  with open(temp_filepath, "wb") as f:
36
  f.write(text_docs.getvalue())
37
  text_loader = TextLoader(temp_filepath)
38
- text_docs = text_loader.load()
39
- return text_docs
40
 
41
 
42
  def get_csv_file(csv_docs):
@@ -45,17 +45,17 @@ def get_csv_file(csv_docs):
45
  with open(temp_filepath, "wb") as f:
46
  f.write(csv_docs.getvalue())
47
  csv_loader = CSVLoader(temp_filepath)
48
- csv_docs = csv_loader.load()
49
- return csv_docs
50
 
51
  def get_json_file(json_docs):
52
  temp_dir = tempfile.TemporaryDirectory()
53
  temp_filepath = os.path.join(temp_dir.name, json_docs.name)
54
  with open(temp_filepath, "wb") as f:
55
  f.write(json_docs.getvalue())
56
- json_loader = JSONLoader(temp_filepath, 'users[].firstName')
57
- json_docs = json_loader.load()
58
- return json_docs
59
 
60
 
61
  # 문서들을 처리하여 텍스트 청크로 나누는 함수입니다.
 
35
  with open(temp_filepath, "wb") as f:
36
  f.write(text_docs.getvalue())
37
  text_loader = TextLoader(temp_filepath)
38
+ text_doc = text_loader.load()
39
+ return text_doc
40
 
41
 
42
  def get_csv_file(csv_docs):
 
45
  with open(temp_filepath, "wb") as f:
46
  f.write(csv_docs.getvalue())
47
  csv_loader = CSVLoader(temp_filepath)
48
+ csv_doc = csv_loader.load()
49
+ return csv_doc
50
 
51
  def get_json_file(json_docs):
52
  temp_dir = tempfile.TemporaryDirectory()
53
  temp_filepath = os.path.join(temp_dir.name, json_docs.name)
54
  with open(temp_filepath, "wb") as f:
55
  f.write(json_docs.getvalue())
56
+ json_loader = JSONLoader(temp_filepath, '.messages[].content', False)
57
+ json_doc = json_loader.load()
58
+ return json_doc
59
 
60
 
61
  # 문서들을 처리하여 텍스트 청크로 나누는 함수입니다.