Spaces:
Runtime error
Runtime error
Commit
·
3725074
1
Parent(s):
4fd2c19
Update app.py
Browse files
app.py
CHANGED
|
@@ -310,20 +310,22 @@ class KeyValueExtractor:
|
|
| 310 |
|
| 311 |
def main_for_news(self,keyword):
|
| 312 |
|
| 313 |
-
|
| 314 |
urls = self.get_news(keyword)
|
| 315 |
tot_urls = self.url_format(urls)
|
| 316 |
clean_url = self.clear_error_ulr(tot_urls)
|
| 317 |
each_link_summary = self.get_each_link_summary(clean_url)
|
|
|
|
| 318 |
file_path = self.save_text_to_file(each_link_summary)
|
| 319 |
docs = self.document_loader(file_path)
|
| 320 |
split_docs = self.document_text_spilliter(docs)
|
|
|
|
| 321 |
result_summary_for_news,key_value_pair_for_news = self.refine_summary(split_docs)
|
| 322 |
fig = self.display_graph_for_news(result_summary_for_news)
|
| 323 |
|
| 324 |
return result_summary_for_news,key_value_pair_for_news,fig
|
| 325 |
-
|
| 326 |
-
|
| 327 |
|
| 328 |
|
| 329 |
def get_url(self,keyword):
|
|
|
|
| 310 |
|
| 311 |
def main_for_news(self,keyword):
|
| 312 |
|
| 313 |
+
try:
|
| 314 |
urls = self.get_news(keyword)
|
| 315 |
tot_urls = self.url_format(urls)
|
| 316 |
clean_url = self.clear_error_ulr(tot_urls)
|
| 317 |
each_link_summary = self.get_each_link_summary(clean_url)
|
| 318 |
+
print("half")
|
| 319 |
file_path = self.save_text_to_file(each_link_summary)
|
| 320 |
docs = self.document_loader(file_path)
|
| 321 |
split_docs = self.document_text_spilliter(docs)
|
| 322 |
+
print("half1")
|
| 323 |
result_summary_for_news,key_value_pair_for_news = self.refine_summary(split_docs)
|
| 324 |
fig = self.display_graph_for_news(result_summary_for_news)
|
| 325 |
|
| 326 |
return result_summary_for_news,key_value_pair_for_news,fig
|
| 327 |
+
except:
|
| 328 |
+
return "Sorry No URL Found!! Please Try Again","",None
|
| 329 |
|
| 330 |
|
| 331 |
def get_url(self,keyword):
|