Moonjunho commited on
Commit
c6c11d3
1 Parent(s): e858ab4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -9
app.py CHANGED
@@ -30,20 +30,17 @@ def get_text_file(docs):
30
  def get_csv_file(docs):
31
  pass
32
 
33
- def get_json_file(json_docs):
34
- temp_dir = tempfile.TemporaryDirectory()
35
- temp_filepath = os.path.join(temp_dir.name, json_docs.name)
36
- with open(temp_filepath, "wb") as f:
37
- f.write(json_docs.getvalue())
38
 
39
-
40
  loader = JSONLoader(
41
- file_path= temp_filepath,
42
  jq_schema='.messages[].content',
43
  text_content=False)
44
 
45
- json_doc = loader.load()
46
- return json_doc
47
 
48
 
49
 
 
30
  def get_csv_file(docs):
31
  pass
32
 
33
+ def get_json_file(docs):
34
+ file_path='./example_data/facebook_chat.json'
35
+ data = json.loads(Path(file_path).read_text())
 
 
36
 
 
37
  loader = JSONLoader(
38
+ file_path='./example_data/facebook_chat.json',
39
  jq_schema='.messages[].content',
40
  text_content=False)
41
 
42
+ data = loader.load()
43
+ return data
44
 
45
 
46