lds204 commited on
Commit
7f067c0
β€’
1 Parent(s): 1d332b7
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -30,7 +30,7 @@ def get_pdf_text(pdf_docs):
30
  def get_text_file(txt_docs):
31
  temp_dir = tempfile.TemporaryDirectory() # μž„μ‹œ 디렉토리λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
32
  temp_filepath = os.path.join(temp_dir.name, txt_docs.name) # μž„μ‹œ 파일 경둜λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
33
- with open(temp_filepath, "wb") as f:
34
  f.write(txt_docs.getvalue())
35
  txt_loader = TextLoader(temp_filepath)
36
  txt_doc = txt_loader.load()
@@ -42,7 +42,7 @@ def get_csv_file(csv_docs):
42
  with open(temp_filepath, "wb") as f:
43
  f.write(csv_docs.getvalue())
44
  csv_loader = CSVLoader(temp_filepath)
45
- csv_doc = pdf_loader.load()
46
  return csv_doc
47
 
48
  def get_json_file(json_docs):
@@ -51,7 +51,7 @@ def get_json_file(json_docs):
51
  with open(temp_filepath, "wb") as f: # μž„μ‹œ νŒŒμΌμ„ λ°”μ΄λ„ˆλ¦¬ μ“°κΈ° λͺ¨λ“œλ‘œ μ—½λ‹ˆλ‹€.
52
  f.write(json_docs.getvalue())
53
  json_loader = JSONLoader(
54
- file_path='./example_data/facebook_chat.json',
55
  jq_schema='.messages[].content',
56
  text_content=False)
57
  json_doc = json_loader.load()
 
30
  def get_text_file(txt_docs):
31
  temp_dir = tempfile.TemporaryDirectory() # μž„μ‹œ 디렉토리λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
32
  temp_filepath = os.path.join(temp_dir.name, txt_docs.name) # μž„μ‹œ 파일 경둜λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
33
+ with open(temp_filepath, "wb") as f: # μž„μ‹œ νŒŒμΌμ„ λ°”μ΄λ„ˆλ¦¬ μ“°κΈ° λͺ¨λ“œλ‘œ μ—½λ‹ˆλ‹€.
34
  f.write(txt_docs.getvalue())
35
  txt_loader = TextLoader(temp_filepath)
36
  txt_doc = txt_loader.load()
 
42
  with open(temp_filepath, "wb") as f:
43
  f.write(csv_docs.getvalue())
44
  csv_loader = CSVLoader(temp_filepath)
45
+ csv_doc = csv_loader.load()
46
  return csv_doc
47
 
48
  def get_json_file(json_docs):
 
51
  with open(temp_filepath, "wb") as f: # μž„μ‹œ νŒŒμΌμ„ λ°”μ΄λ„ˆλ¦¬ μ“°κΈ° λͺ¨λ“œλ‘œ μ—½λ‹ˆλ‹€.
52
  f.write(json_docs.getvalue())
53
  json_loader = JSONLoader(
54
+ file_path = temp_filepath,
55
  jq_schema='.messages[].content',
56
  text_content=False)
57
  json_doc = json_loader.load()