Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -153,7 +153,18 @@ nltk.download('averaged_perceptron_tagger')
|
|
153 |
# return outputs.last_hidden_state.mean(dim=1).squeeze().numpy()
|
154 |
|
155 |
|
156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
|
158 |
# Text Cleaning
|
159 |
text = re.sub(r'[^\w\s]', '', text)
|
|
|
153 |
# return outputs.last_hidden_state.mean(dim=1).squeeze().numpy()
|
154 |
|
155 |
|
156 |
+
|
157 |
+
from transformers import pipeline
|
158 |
+
# Load a summarization model
|
159 |
+
summarizer = pipeline("summarization")
|
160 |
+
|
161 |
+
|
162 |
+
|
163 |
+
def text_processing_for_domain(unsummarized_text):
|
164 |
+
|
165 |
+
# Summarization
|
166 |
+
text = summarizer(unsummarized_text, max_length=70, min_length=30, do_sample=False)[0]['summary_text']
|
167 |
+
|
168 |
|
169 |
# Text Cleaning
|
170 |
text = re.sub(r'[^\w\s]', '', text)
|