Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,7 +31,7 @@ def get_pdf_text(pdf_docs):
|
|
| 31 |
def get_text_file(txt_docs):
|
| 32 |
temp_text_dir = tempfile.TemporaryDirectory()
|
| 33 |
temp_text_filepath = os.path.join(temp_text_dir.name, txt_docs.name)
|
| 34 |
-
with open(temp_text_filepath, "wb") as f:
|
| 35 |
f.write(txt_docs.getvalue())
|
| 36 |
text_loader = TextLoader(temp_text_filepath)
|
| 37 |
txt_doc = text_loader.load()
|
|
@@ -42,7 +42,7 @@ def get_text_file(txt_docs):
|
|
| 42 |
def get_csv_file(csv_docs):
|
| 43 |
temp_csv_dir = tempfile.TemporaryDirectory()
|
| 44 |
temp_csv_filepath = os.path.join(temp_csv_dir.name, csv_docs.name)
|
| 45 |
-
with open(temp_csv_filepath, "wb") as f:
|
| 46 |
f.write(csv_docs.getvalue())
|
| 47 |
csv_loader = CSVLoader(temp_csv_filepath)
|
| 48 |
csv_doc = csv_loader.load()
|
|
@@ -51,7 +51,7 @@ def get_csv_file(csv_docs):
|
|
| 51 |
def get_json_file(json_docs):
|
| 52 |
temp_json_dir = tempfile.TemporaryDirectory()
|
| 53 |
temp_json_filepath = os.path.join(temp_json_dir.name, json_docs.name)
|
| 54 |
-
with open(temp_json_filepath, "wb") as f:
|
| 55 |
f.write(json_docs.getvalue())
|
| 56 |
json_loader = JSONLoader(temp_json_filepath,jq_schema='.',text_content=False)
|
| 57 |
json_doc = json_loader.load()
|
|
|
|
| 31 |
def get_text_file(txt_docs):
|
| 32 |
temp_text_dir = tempfile.TemporaryDirectory()
|
| 33 |
temp_text_filepath = os.path.join(temp_text_dir.name, txt_docs.name)
|
| 34 |
+
with open(temp_text_filepath, "wb") as f:
|
| 35 |
f.write(txt_docs.getvalue())
|
| 36 |
text_loader = TextLoader(temp_text_filepath)
|
| 37 |
txt_doc = text_loader.load()
|
|
|
|
| 42 |
def get_csv_file(csv_docs):
|
| 43 |
temp_csv_dir = tempfile.TemporaryDirectory()
|
| 44 |
temp_csv_filepath = os.path.join(temp_csv_dir.name, csv_docs.name)
|
| 45 |
+
with open(temp_csv_filepath, "wb") as f:
|
| 46 |
f.write(csv_docs.getvalue())
|
| 47 |
csv_loader = CSVLoader(temp_csv_filepath)
|
| 48 |
csv_doc = csv_loader.load()
|
|
|
|
| 51 |
def get_json_file(json_docs):
|
| 52 |
temp_json_dir = tempfile.TemporaryDirectory()
|
| 53 |
temp_json_filepath = os.path.join(temp_json_dir.name, json_docs.name)
|
| 54 |
+
with open(temp_json_filepath, "wb") as f:
|
| 55 |
f.write(json_docs.getvalue())
|
| 56 |
json_loader = JSONLoader(temp_json_filepath,jq_schema='.',text_content=False)
|
| 57 |
json_doc = json_loader.load()
|