Nahyunho commited on
Commit
6ea8387
β€’
1 Parent(s): f89a9bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -33,20 +33,19 @@ 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 = TextLoader(temp_file.name)
37
- text_doc = text_loader.load()
38
-
39
- return text_doc
40
 
41
  def get_csv_file(csv_docs):
42
  temp_dir = tempfile.TemporaryDirectory() # μž„μ‹œ 디렉토리λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
43
  temp_filepath = os.path.join(temp_dir.name, csv_docs.name) # μž„μ‹œ 파일 경둜λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
44
  with open(temp_filepath, "wb") as f: # μž„μ‹œ νŒŒμΌμ„ λ°”μ΄λ„ˆλ¦¬ μ“°κΈ° λͺ¨λ“œλ‘œ μ—½λ‹ˆλ‹€.
45
  f.write(csv_docs.getvalue())
46
- csv_loader = CSVLoader(temp_file.name)
47
- csv_doc = csv_loader.load()
48
 
49
- return csv_doc
50
 
51
  def get_json_file(json_docs):
52
  temp_dir = tempfile.TemporaryDirectory() # μž„μ‹œ 디렉토리λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
@@ -55,6 +54,7 @@ def get_json_file(json_docs):
55
  f.write(json_docs.getvalue())
56
  json_loader = JSONLoader(temp_file.name,jq_schema='.messages[].content',text_content=False)
57
  json_doc=json_loader.load
 
58
  return json_doc
59
 
60
 
 
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_file.name)
37
+ text_doc = text_loader.load()
38
+ return text_doc
 
39
 
40
  def get_csv_file(csv_docs):
41
  temp_dir = tempfile.TemporaryDirectory() # μž„μ‹œ 디렉토리λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
42
  temp_filepath = os.path.join(temp_dir.name, csv_docs.name) # μž„μ‹œ 파일 경둜λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
43
  with open(temp_filepath, "wb") as f: # μž„μ‹œ νŒŒμΌμ„ λ°”μ΄λ„ˆλ¦¬ μ“°κΈ° λͺ¨λ“œλ‘œ μ—½λ‹ˆλ‹€.
44
  f.write(csv_docs.getvalue())
45
+ csv_loader = CSVLoader(temp_file.name)
46
+ csv_doc = csv_loader.load()
47
 
48
+ return csv_doc
49
 
50
  def get_json_file(json_docs):
51
  temp_dir = tempfile.TemporaryDirectory() # μž„μ‹œ 디렉토리λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
 
54
  f.write(json_docs.getvalue())
55
  json_loader = JSONLoader(temp_file.name,jq_schema='.messages[].content',text_content=False)
56
  json_doc=json_loader.load
57
+
58
  return json_doc
59
 
60