Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -156,14 +156,17 @@ def inference(input_batch,isurl,use_archive,limit_companies=10):
|
|
| 156 |
print("[i] Batch size:",len(input_batch_content))
|
| 157 |
print("[i] Running ESG classifier inference...")
|
| 158 |
prob_outs = _inference_classifier(input_batch_content)
|
|
|
|
| 159 |
print("[i] Running sentiment using",MODEL_SENTIMENT_ANALYSIS ,"inference...")
|
| 160 |
#sentiment = _inference_sentiment_model_via_api_query({"inputs": extracted['content']})
|
| 161 |
-
sentiment = _inference_sentiment_model_pipeline(input_batch_content )
|
|
|
|
| 162 |
#summary = _inference_summary_model_pipeline(input_batch_content )[0]['generated_text']
|
| 163 |
#ner_labels = _inference_ner_spancat(input_batch_content ,summary, penalty = 0.8, limit_outputs=limit_companies)
|
| 164 |
df = pd.DataFrame(prob_outs,columns =['E','S','G'])
|
| 165 |
df['sent_lbl'] = sentiment['label']
|
| 166 |
df['sent_score'] = sentiment['score']
|
|
|
|
| 167 |
|
| 168 |
return df #ner_labels, {'E':float(prob_outs[0]),"S":float(prob_outs[1]),"G":float(prob_outs[2])},{sentiment['label']:float(sentiment['score'])},"**Summary:**\n\n" + summary
|
| 169 |
|
|
|
|
| 156 |
print("[i] Batch size:",len(input_batch_content))
|
| 157 |
print("[i] Running ESG classifier inference...")
|
| 158 |
prob_outs = _inference_classifier(input_batch_content)
|
| 159 |
+
print("[i] Classifier output shape:",prob_outs.shape)
|
| 160 |
print("[i] Running sentiment using",MODEL_SENTIMENT_ANALYSIS ,"inference...")
|
| 161 |
#sentiment = _inference_sentiment_model_via_api_query({"inputs": extracted['content']})
|
| 162 |
+
sentiment = _inference_sentiment_model_pipeline(input_batch_content )
|
| 163 |
+
print("[i] Sentiment output:",sentiment )
|
| 164 |
#summary = _inference_summary_model_pipeline(input_batch_content )[0]['generated_text']
|
| 165 |
#ner_labels = _inference_ner_spancat(input_batch_content ,summary, penalty = 0.8, limit_outputs=limit_companies)
|
| 166 |
df = pd.DataFrame(prob_outs,columns =['E','S','G'])
|
| 167 |
df['sent_lbl'] = sentiment['label']
|
| 168 |
df['sent_score'] = sentiment['score']
|
| 169 |
+
print("[i] Pandas output shape:",df.shape)
|
| 170 |
|
| 171 |
return df #ner_labels, {'E':float(prob_outs[0]),"S":float(prob_outs[1]),"G":float(prob_outs[2])},{sentiment['label']:float(sentiment['score'])},"**Summary:**\n\n" + summary
|
| 172 |
|