minji1115 commited on
Commit
39aa2f9
·
1 Parent(s): f88a678
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -41,8 +41,8 @@ def get_text_file(text_docs):
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, "w") as f:
45
- f.write(csv_docs.getvalue())
46
  csv_loader = CSVLoader(temp_filepath)
47
  csv_docs = csv_loader.load()
48
  return csv_docs
@@ -52,7 +52,7 @@ def get_json_file(json_docs):
52
  temp_filepath = os.path.join(temp_dir.name, json_docs.name)
53
  with open(temp_filepath, "wb") as f:
54
  f.write(json_docs.getvalue())
55
- json_loader = JSONLoader(temp_filepath, 'messages[].content')
56
  json_docs = json_loader.load()
57
  return json_docs
58
 
 
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().encode('utf-8'))
46
  csv_loader = CSVLoader(temp_filepath)
47
  csv_docs = csv_loader.load()
48
  return csv_docs
 
52
  temp_filepath = os.path.join(temp_dir.name, json_docs.name)
53
  with open(temp_filepath, "wb") as f:
54
  f.write(json_docs.getvalue())
55
+ json_loader = JSONLoader(temp_filepath, 'users')
56
  json_docs = json_loader.load()
57
  return json_docs
58