Update app.py
Browse files
app.py
CHANGED
@@ -19,8 +19,16 @@ def read_txt(file_path):
|
|
19 |
text = file.read()
|
20 |
return text
|
21 |
|
|
|
|
|
|
|
22 |
# Load text from the specified file
|
23 |
-
text_file_path = '
|
|
|
|
|
|
|
|
|
|
|
24 |
user_query = read_txt(text_file_path)
|
25 |
|
26 |
# Set up text processing components
|
|
|
19 |
text = file.read()
|
20 |
return text
|
21 |
|
22 |
+
# Determine the path to the content folder
|
23 |
+
content_folder = os.path.join(os.getcwd(), 'content')
|
24 |
+
|
25 |
# Load text from the specified file
|
26 |
+
text_file_path = os.path.join(content_folder, 'lawsofpower.txt')
|
27 |
+
|
28 |
+
# Check if the file exists before attempting to read it
|
29 |
+
if not os.path.exists(text_file_path):
|
30 |
+
raise FileNotFoundError(f"The file '{text_file_path}' does not exist.")
|
31 |
+
|
32 |
user_query = read_txt(text_file_path)
|
33 |
|
34 |
# Set up text processing components
|