SantanuBanerjee commited on
Commit
7386d73
·
verified ·
1 Parent(s): ea95a7e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -162,10 +162,12 @@ summarizer = pipeline("summarization")
162
 
163
 
164
  def text_processing_for_domain(unsummarized_text):
165
-
166
- # Summarization
167
- text = summarizer(unsummarized_text, max_length=70, min_length=30, do_sample=False)[0]['summary_text']
168
-
 
 
169
 
170
  # Text Cleaning
171
  text = re.sub(r'[^\w\s]', '', text)
 
162
 
163
 
164
  def text_processing_for_domain(unsummarized_text):
165
+ try:
166
+ # Summarization
167
+ text = summarizer(unsummarized_text, max_length=70, min_length=30, do_sample=False)[0]['summary_text']
168
+ except Exception as e:
169
+ print(f"Summarization failed: {e}")
170
+ text = unsummarized_text
171
 
172
  # Text Cleaning
173
  text = re.sub(r'[^\w\s]', '', text)