nyoo827 commited on
Commit
bfe5a0f
β€’
1 Parent(s): 7cb402e

Update app.py

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