Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -46,35 +46,26 @@ def chatbot(your_role,school_selection,output_format,input_text):
|
|
46 |
header = file.read()
|
47 |
|
48 |
# school_selection holds an array of one or more schools, so create a comma delimited str to process.
|
49 |
-
|
50 |
-
str=",".join(school_selection)
|
51 |
|
52 |
# Read the Hydrated policies
|
53 |
-
|
54 |
-
# Split the input string by commas to get the list of university names
|
55 |
-
university_names = str.split(',')
|
56 |
-
|
57 |
policies = ''
|
58 |
|
59 |
-
|
60 |
-
# Construct the file path
|
61 |
-
file_path = f"nili_hydrated_policies/{university}.txt"
|
62 |
|
|
|
|
|
63 |
try:
|
64 |
-
# Open the file and read its contents
|
65 |
with open(file_path, 'r', encoding='utf-8') as file:
|
66 |
content = file.read()
|
67 |
-
|
68 |
-
# If 'policies' already has content, add separator before appending
|
69 |
-
if policies:
|
70 |
policies += "\n----------\n"
|
71 |
-
|
72 |
policies += content
|
73 |
-
|
74 |
except FileNotFoundError:
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
with open('combined_policies.txt', 'w', encoding='utf-8') as out_file:
|
79 |
out_file.write(policies)
|
80 |
|
|
|
46 |
header = file.read()
|
47 |
|
48 |
# school_selection holds an array of one or more schools, so create a comma delimited str to process.
|
49 |
+
print(school_selection)
|
50 |
+
#str=",".join(school_selection)
|
51 |
|
52 |
# Read the Hydrated policies
|
53 |
+
|
|
|
|
|
|
|
54 |
policies = ''
|
55 |
|
56 |
+
folder_path = 'nili_hydrated_policies'
|
|
|
|
|
57 |
|
58 |
+
for school in school_selection:
|
59 |
+
file_path = f"{folder_path}/{school}.txt"
|
60 |
try:
|
|
|
61 |
with open(file_path, 'r', encoding='utf-8') as file:
|
62 |
content = file.read()
|
63 |
+
if policies: # If 'policies' already has content, add separator before appending
|
|
|
|
|
64 |
policies += "\n----------\n"
|
|
|
65 |
policies += content
|
|
|
66 |
except FileNotFoundError:
|
67 |
+
print(f"File {file_path} not found!")
|
68 |
+
|
|
|
69 |
with open('combined_policies.txt', 'w', encoding='utf-8') as out_file:
|
70 |
out_file.write(policies)
|
71 |
|