se0kcess commited on
Commit
3b6702c
1 Parent(s): 92e4206
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -27,8 +27,8 @@ def get_pdf_text(pdf_docs):
27
  def get_text_file(txt_docs):
28
  temp_dir = tempfile.TemporaryDirectory()
29
  temp_filepath = os.path.join(temp_dir.name, txt_docs.name)
30
- with open(temp_filepath, "w", encoding="utf-8") as f:
31
- f.write(txt_docs.getvalue())
32
  txt_loader = TextLoader(temp_filepath)
33
  txt_doc = txt_loader.load()
34
  return txt_doc
@@ -36,8 +36,8 @@ def get_text_file(txt_docs):
36
  def get_csv_file(csv_docs):
37
  temp_dir = tempfile.TemporaryDirectory()
38
  temp_filepath = os.path.join(temp_dir.name, csv_docs.name)
39
- with open(temp_filepath, "w", encoding="utf-8") as f:
40
- f.write(csv_docs.getvalue())
41
  csv_loader = CSVLoader(temp_filepath)
42
  csv_doc = csv_loader.load()
43
  return csv_doc
@@ -45,8 +45,8 @@ def get_csv_file(csv_docs):
45
  def get_json_file(json_docs):
46
  temp_dir = tempfile.TemporaryDirectory()
47
  temp_filepath = os.path.join(temp_dir.name, json_docs.name)
48
- with open(temp_filepath, "w", encoding="utf-8") as f:
49
- f.write(json_docs.getvalue())
50
  json_loader = JSONLoader(temp_filepath)
51
  json_doc = json_loader.load()
52
  return json_doc
 
27
  def get_text_file(txt_docs):
28
  temp_dir = tempfile.TemporaryDirectory()
29
  temp_filepath = os.path.join(temp_dir.name, txt_docs.name)
30
+ with open(temp_filepath, "w", encoding="utf-8") as t:
31
+ t.write(txt_docs.getvalue())
32
  txt_loader = TextLoader(temp_filepath)
33
  txt_doc = txt_loader.load()
34
  return txt_doc
 
36
  def get_csv_file(csv_docs):
37
  temp_dir = tempfile.TemporaryDirectory()
38
  temp_filepath = os.path.join(temp_dir.name, csv_docs.name)
39
+ with open(temp_filepath, "w", encoding="utf-8") as v:
40
+ v.write(csv_docs.getvalue())
41
  csv_loader = CSVLoader(temp_filepath)
42
  csv_doc = csv_loader.load()
43
  return csv_doc
 
45
  def get_json_file(json_docs):
46
  temp_dir = tempfile.TemporaryDirectory()
47
  temp_filepath = os.path.join(temp_dir.name, json_docs.name)
48
+ with open(temp_filepath, "w", encoding="utf-8") as j:
49
+ j.write(json_docs.getvalue())
50
  json_loader = JSONLoader(temp_filepath)
51
  json_doc = json_loader.load()
52
  return json_doc