Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,10 +29,6 @@ import flask
|
|
| 29 |
import os
|
| 30 |
from dotenv import load_dotenv
|
| 31 |
load_dotenv()
|
| 32 |
-
global documents
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
|
| 37 |
loader = UnstructuredFileLoader('Jio.txt', mode='elements')
|
| 38 |
documents= loader.load()
|
|
@@ -79,9 +75,9 @@ def file_Upload():
|
|
| 79 |
print("*******")
|
| 80 |
print(not ('documents' in vars() or 'documents' in globals()))
|
| 81 |
# if not ('documents' in vars() or 'documents' in globals()):
|
| 82 |
-
|
| 83 |
if fileprovided:
|
| 84 |
-
|
| 85 |
#Delete Files
|
| 86 |
for filename in os.listdir(uploads_dir):
|
| 87 |
file_path = os.path.join(uploads_dir, filename)
|
|
@@ -99,9 +95,9 @@ def file_Upload():
|
|
| 99 |
file.save(os.path.join(uploads_dir, secure_filename(file.filename)))
|
| 100 |
loader = UnstructuredFileLoader(os.path.join(uploads_dir, secure_filename(file.filename)), mode='elements')
|
| 101 |
documents.extend(loader.load())
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
|
| 106 |
if urlProvided:
|
| 107 |
urlList=request.form.getlist('weburl')
|
|
|
|
| 29 |
import os
|
| 30 |
from dotenv import load_dotenv
|
| 31 |
load_dotenv()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
loader = UnstructuredFileLoader('Jio.txt', mode='elements')
|
| 34 |
documents= loader.load()
|
|
|
|
| 75 |
print("*******")
|
| 76 |
print(not ('documents' in vars() or 'documents' in globals()))
|
| 77 |
# if not ('documents' in vars() or 'documents' in globals()):
|
| 78 |
+
documents = []
|
| 79 |
if fileprovided:
|
| 80 |
+
|
| 81 |
#Delete Files
|
| 82 |
for filename in os.listdir(uploads_dir):
|
| 83 |
file_path = os.path.join(uploads_dir, filename)
|
|
|
|
| 95 |
file.save(os.path.join(uploads_dir, secure_filename(file.filename)))
|
| 96 |
loader = UnstructuredFileLoader(os.path.join(uploads_dir, secure_filename(file.filename)), mode='elements')
|
| 97 |
documents.extend(loader.load())
|
| 98 |
+
else:
|
| 99 |
+
loader = UnstructuredFileLoader('Jio.txt', mode='elements')
|
| 100 |
+
documents.extend(loader.load())
|
| 101 |
|
| 102 |
if urlProvided:
|
| 103 |
urlList=request.form.getlist('weburl')
|