jungwoo3490 commited on
Commit
f081f03
·
1 Parent(s): 833e5d5

edit app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -32,7 +32,7 @@ def get_pdf_text(pdf_docs):
32
  def get_text_file(docs):
33
  temp_dir = tempfile.TemporaryDirectory()
34
  temp_filepath = os.path.join(temp_dir.name, docs.name)
35
- with open(temp_filepath, "wb") as f:
36
  f.write(docs.getvalue())
37
  loader = TextLoader(temp_filepath)
38
  text_doc = loader.load()
@@ -42,7 +42,7 @@ def get_text_file(docs):
42
  def get_csv_file(csv_docs):
43
  temp_dir = tempfile.TemporaryDirectory()
44
  temp_filepath = os.path.join(temp_dir.name, csv_docs.name)
45
- with open(temp_filepath, "utf-8") as f:
46
  f.write(csv_docs.getvalue())
47
  loader = CSVLoader(temp_filepath)
48
  csv_doc = loader.load()
@@ -52,7 +52,7 @@ def get_csv_file(csv_docs):
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
- with open(temp_filepath, "utf-8") as f:
56
  f.write(json_docs.getvalue())
57
  loader = JSONLoader(temp_filepath, jq_schema="테스트")
58
  json_doc = loader.load()
 
32
  def get_text_file(docs):
33
  temp_dir = tempfile.TemporaryDirectory()
34
  temp_filepath = os.path.join(temp_dir.name, docs.name)
35
+ with open(temp_filepath, "w") as f:
36
  f.write(docs.getvalue())
37
  loader = TextLoader(temp_filepath)
38
  text_doc = loader.load()
 
42
  def get_csv_file(csv_docs):
43
  temp_dir = tempfile.TemporaryDirectory()
44
  temp_filepath = os.path.join(temp_dir.name, csv_docs.name)
45
+ with open(temp_filepath, "w") as f:
46
  f.write(csv_docs.getvalue())
47
  loader = CSVLoader(temp_filepath)
48
  csv_doc = loader.load()
 
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
+ with open(temp_filepath, "w") as f:
56
  f.write(json_docs.getvalue())
57
  loader = JSONLoader(temp_filepath, jq_schema="테스트")
58
  json_doc = loader.load()