Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -162,8 +162,6 @@ def calculate_similarity_score(sentences):
|
|
162 |
|
163 |
# Scale from [-1, 1] to [0, 100]
|
164 |
score_out_of_100 = (average_similarity + 1) / 2 * 100
|
165 |
-
|
166 |
-
|
167 |
return score_out_of_100
|
168 |
|
169 |
def answer_question(prompt):
|
@@ -212,9 +210,18 @@ def send_email(receiver_email, subject, body):
|
|
212 |
def process_and_email(file_info, email_address):
|
213 |
# Process the file
|
214 |
processed_text = process_file(file_info['path'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
|
216 |
# Email the processed text
|
217 |
-
send_email(email_address, "Processed File Results",
|
218 |
|
219 |
return "Results sent to your email!"
|
220 |
|
|
|
162 |
|
163 |
# Scale from [-1, 1] to [0, 100]
|
164 |
score_out_of_100 = (average_similarity + 1) / 2 * 100
|
|
|
|
|
165 |
return score_out_of_100
|
166 |
|
167 |
def answer_question(prompt):
|
|
|
210 |
def process_and_email(file_info, email_address):
|
211 |
# Process the file
|
212 |
processed_text = process_file(file_info['path'])
|
213 |
+
|
214 |
+
answered_text = answer_question(processed_text) # Assuming 'answer' is a function defined elsewhere
|
215 |
+
|
216 |
+
# Save the answered_text as CSV format
|
217 |
+
processed = 'processed_results.csv'
|
218 |
+
with open(processed, 'w', newline='', encoding='utf-8') as csv_file:
|
219 |
+
csv_writer = csv.writer(csv_file)
|
220 |
+
# Assuming answered_text is a list of lists or similar iterable suitable for CSV writing
|
221 |
+
csv_writer.writerows(answered_text)
|
222 |
|
223 |
# Email the processed text
|
224 |
+
send_email(email_address, "Processed File Results", processed)
|
225 |
|
226 |
return "Results sent to your email!"
|
227 |
|