nyoo827 commited on
Commit
35331ff
Β·
1 Parent(s): 948317d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -29,7 +29,7 @@ def get_text_file(text_docs):
29
  temp_filepath = os.path.join(temp_dir.name, text_docs.name) # μž„μ‹œ 파일 경둜λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
30
  with open(temp_filepath, "wb") as f: # μž„μ‹œ νŒŒμΌμ„ λ°”μ΄λ„ˆλ¦¬ μ“°κΈ° λͺ¨λ“œλ‘œ μ—½λ‹ˆλ‹€.
31
  f.write(text_docs.getvalue())
32
- text_loader = DirectoryLoader(temp_filepath)
33
  text_doc = text_loader.load()
34
  return text_doc
35
 
@@ -47,7 +47,11 @@ def get_json_file(json_docs):
47
  temp_filepath = os.path.join(temp_dir.name, json_docs.name) # μž„μ‹œ 파일 경둜λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
48
  with open(temp_filepath, "wb") as f: # μž„μ‹œ νŒŒμΌμ„ λ°”μ΄λ„ˆλ¦¬ μ“°κΈ° λͺ¨λ“œλ‘œ μ—½λ‹ˆλ‹€.
49
  f.write(json_docs.getvalue())
50
- json_loader = JSONLoader(temp_filepath)
 
 
 
 
51
  json_doc = json_loader.load()
52
  return json_doc
53
 
 
29
  temp_filepath = os.path.join(temp_dir.name, text_docs.name) # μž„μ‹œ 파일 경둜λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
30
  with open(temp_filepath, "wb") as f: # μž„μ‹œ νŒŒμΌμ„ λ°”μ΄λ„ˆλ¦¬ μ“°κΈ° λͺ¨λ“œλ‘œ μ—½λ‹ˆλ‹€.
31
  f.write(text_docs.getvalue())
32
+ text_loader = TextLoader(temp_filepath)
33
  text_doc = text_loader.load()
34
  return text_doc
35
 
 
47
  temp_filepath = os.path.join(temp_dir.name, json_docs.name) # μž„μ‹œ 파일 경둜λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
48
  with open(temp_filepath, "wb") as f: # μž„μ‹œ νŒŒμΌμ„ λ°”μ΄λ„ˆλ¦¬ μ“°κΈ° λͺ¨λ“œλ‘œ μ—½λ‹ˆλ‹€.
49
  f.write(json_docs.getvalue())
50
+ json_loader = JSONLoader(
51
+ file_path='./example_data/facebook_chat.json',
52
+ jq_schema='.messages[].content',
53
+ text_content=False)
54
+ data = loader.load()
55
  json_doc = json_loader.load()
56
  return json_doc
57