JinHyeong99 commited on
Commit
5ae388f
β€’
1 Parent(s): d5e72bf
Files changed (1) hide show
  1. app.py +13 -14
app.py CHANGED
@@ -50,20 +50,19 @@ def get_csv_file(csv_docs):
50
 
51
 
52
  def get_json_file(json_docs):
53
- # temp_dir = tempfile.TemporaryDirectory()
54
- # temp_filepath = os.path.join(temp_dir.name, json_docs.name)
55
- #
56
- # data = open(json_docs, mode='r', encoding='utf-8')
57
- # with open(temp_filepath) as f:
58
- # f.write(data)
59
- #
60
- # json_loader = JSONLoader(
61
- # file_path = temp_filepath,
62
- # jq_schema = '.'
63
- # )
64
- # json_doc = json_loader.load()
65
- # return json_doc
66
- pass
67
 
68
 
69
  # λ¬Έμ„œλ“€μ„ μ²˜λ¦¬ν•˜μ—¬ ν…μŠ€νŠΈ 청크둜 λ‚˜λˆ„λŠ” ν•¨μˆ˜μž…λ‹ˆλ‹€.
 
50
 
51
 
52
  def get_json_file(json_docs):
53
+ temp_dir = tempfile.TemporaryDirectory()
54
+ temp_filepath = os.path.join(temp_dir.name, json_docs.name)
55
+
56
+ data = open(json_docs, mode='r', encoding='utf-8')
57
+ with open(temp_filepath) as f:
58
+ f.write(data)
59
+
60
+ json_loader = JSONLoader(
61
+ file_path = temp_filepath,
62
+ jq_schema = '.'
63
+ )
64
+ json_doc = json_loader.load()
65
+ return json_doc
 
66
 
67
 
68
  # λ¬Έμ„œλ“€μ„ μ²˜λ¦¬ν•˜μ—¬ ν…μŠ€νŠΈ 청크둜 λ‚˜λˆ„λŠ” ν•¨μˆ˜μž…λ‹ˆλ‹€.