Commit
•
2536052
1
Parent(s):
11a6cf5
Update news_category_prediction.py
Browse files
news_category_prediction.py
CHANGED
@@ -85,6 +85,10 @@ def predict_news_category(old_news: pd.DataFrame, new_news: pd.DataFrame, interp
|
|
85 |
final_df.drop_duplicates(subset='url', keep='first', inplace=True)
|
86 |
final_df.reset_index(drop=True, inplace=True)
|
87 |
final_df.loc[final_df['pred_proba']<CLASSIFIER_THRESHOLD, 'category'] = 'OTHERS'
|
|
|
|
|
|
|
|
|
88 |
logger.warning('Exiting predict_news_category()')
|
89 |
except Exception as e:
|
90 |
logger.warning(f'Unexcpected error in predict_news_category()\n{e}')
|
|
|
85 |
final_df.drop_duplicates(subset='url', keep='first', inplace=True)
|
86 |
final_df.reset_index(drop=True, inplace=True)
|
87 |
final_df.loc[final_df['pred_proba']<CLASSIFIER_THRESHOLD, 'category'] = 'OTHERS'
|
88 |
+
|
89 |
+
if len(final_df) == 0:
|
90 |
+
final_df = None
|
91 |
+
|
92 |
logger.warning('Exiting predict_news_category()')
|
93 |
except Exception as e:
|
94 |
logger.warning(f'Unexcpected error in predict_news_category()\n{e}')
|