parkchihoon commited on
Commit
9a000f4
β€’
1 Parent(s): 6e02a76

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -47,8 +47,14 @@ def get_csv_file(csv_docs):
47
  csv_doc = csv_loader.load()
48
  return csv_doc
49
 
50
- def get_json_file(docs):
51
- pass
 
 
 
 
 
 
52
 
53
 
54
  # λ¬Έμ„œλ“€μ„ μ²˜λ¦¬ν•˜μ—¬ ν…μŠ€νŠΈ 청크둜 λ‚˜λˆ„λŠ” ν•¨μˆ˜μž…λ‹ˆλ‹€.
 
47
  csv_doc = csv_loader.load()
48
  return csv_doc
49
 
50
+ def get_json_file(json_docs):
51
+ temp_dir = tempfile.TemporaryDirectory()
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)
56
+ json_doc = json_loader.load()
57
+ return json_doc
58
 
59
 
60
  # λ¬Έμ„œλ“€μ„ μ²˜λ¦¬ν•˜μ—¬ ν…μŠ€νŠΈ 청크둜 λ‚˜λˆ„λŠ” ν•¨μˆ˜μž…λ‹ˆλ‹€.