Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -105,6 +105,7 @@ model = AutoModel.from_pretrained("sentence-transformers/all-mpnet-base-v2")
|
|
105 |
# return outputs.last_hidden_state.mean(dim=1).squeeze().numpy()
|
106 |
|
107 |
|
|
|
108 |
import re
|
109 |
import nltk
|
110 |
from nltk.corpus import stopwords
|
@@ -112,6 +113,10 @@ from nltk.tokenize import word_tokenize
|
|
112 |
# Download necessary NLTK data
|
113 |
nltk.download('punkt')
|
114 |
nltk.download('stopwords')
|
|
|
|
|
|
|
|
|
115 |
|
116 |
# def combined_text_processing(text):
|
117 |
# # Remove punctuation, numbers, URLs, and special characters
|
@@ -307,23 +312,28 @@ def process_excel(file):
|
|
307 |
# Process the DataFrame
|
308 |
result_df = nlp_pipeline(df)
|
309 |
|
310 |
-
output_file = "Output_ProjectProposals.xlsx"
|
|
|
311 |
result_df.to_excel(output_file, index=False)
|
312 |
|
313 |
return output_file # Return the processed DataFrame as Excel file
|
314 |
|
315 |
except Exception as e:
|
316 |
-
return str(e) # Return the error message
|
|
|
|
|
317 |
|
|
|
318 |
|
319 |
|
320 |
|
321 |
|
|
|
|
|
|
|
|
|
322 |
|
323 |
-
example_files = ['
|
324 |
-
'#TaxDirection (Responses)_IntermediateExample.xlsx',
|
325 |
-
'#TaxDirection (Responses)_UltimateExample.xlsx'
|
326 |
-
]
|
327 |
|
328 |
|
329 |
import random
|
|
|
105 |
# return outputs.last_hidden_state.mean(dim=1).squeeze().numpy()
|
106 |
|
107 |
|
108 |
+
|
109 |
import re
|
110 |
import nltk
|
111 |
from nltk.corpus import stopwords
|
|
|
113 |
# Download necessary NLTK data
|
114 |
nltk.download('punkt')
|
115 |
nltk.download('stopwords')
|
116 |
+
nltk.download('averaged_perceptron_tagger')
|
117 |
+
|
118 |
+
|
119 |
+
|
120 |
|
121 |
# def combined_text_processing(text):
|
122 |
# # Remove punctuation, numbers, URLs, and special characters
|
|
|
312 |
# Process the DataFrame
|
313 |
result_df = nlp_pipeline(df)
|
314 |
|
315 |
+
# output_file = "Output_ProjectProposals.xlsx"
|
316 |
+
output_file = "Output_Proposals.xlsx"
|
317 |
result_df.to_excel(output_file, index=False)
|
318 |
|
319 |
return output_file # Return the processed DataFrame as Excel file
|
320 |
|
321 |
except Exception as e:
|
322 |
+
# return str(e) # Return the error message
|
323 |
+
return f"Error: {str(e)}"
|
324 |
+
|
325 |
|
326 |
+
|
327 |
|
328 |
|
329 |
|
330 |
|
331 |
+
# example_files = ['#TaxDirection (Responses)_BasicExample.xlsx',
|
332 |
+
# '#TaxDirection (Responses)_IntermediateExample.xlsx',
|
333 |
+
# '#TaxDirection (Responses)_UltimateExample.xlsx'
|
334 |
+
# ]
|
335 |
|
336 |
+
example_files = ['a.xlsx',]
|
|
|
|
|
|
|
337 |
|
338 |
|
339 |
import random
|