Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,7 +34,7 @@ load_dotenv()
|
|
| 34 |
|
| 35 |
|
| 36 |
loader = UnstructuredFileLoader('Jio.txt', mode='elements')
|
| 37 |
-
documents= loader.load()
|
| 38 |
|
| 39 |
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1500, chunk_overlap=150)
|
| 40 |
texts = text_splitter.split_documents(documents)
|
|
@@ -76,9 +76,10 @@ def file_Upload():
|
|
| 76 |
print("URL Provided:"+str(urlProvided))
|
| 77 |
print("*******")
|
| 78 |
print(not ('documents' in vars() or 'documents' in globals()))
|
| 79 |
-
if not ('documents' in vars() or 'documents' in globals()):
|
| 80 |
-
|
| 81 |
if fileprovided:
|
|
|
|
| 82 |
#Delete Files
|
| 83 |
for filename in os.listdir(uploads_dir):
|
| 84 |
file_path = os.path.join(uploads_dir, filename)
|
|
|
|
| 34 |
|
| 35 |
|
| 36 |
loader = UnstructuredFileLoader('Jio.txt', mode='elements')
|
| 37 |
+
global documents= loader.load()
|
| 38 |
|
| 39 |
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1500, chunk_overlap=150)
|
| 40 |
texts = text_splitter.split_documents(documents)
|
|
|
|
| 76 |
print("URL Provided:"+str(urlProvided))
|
| 77 |
print("*******")
|
| 78 |
print(not ('documents' in vars() or 'documents' in globals()))
|
| 79 |
+
# if not ('documents' in vars() or 'documents' in globals()):
|
| 80 |
+
|
| 81 |
if fileprovided:
|
| 82 |
+
documents = []
|
| 83 |
#Delete Files
|
| 84 |
for filename in os.listdir(uploads_dir):
|
| 85 |
file_path = os.path.join(uploads_dir, filename)
|