Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -160,12 +160,11 @@ def inference(input_batch,isurl,use_archive,limit_companies=10):
|
|
| 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'] =
|
| 168 |
-
df['sent_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
|
|
|
|
| 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 |
#summary = _inference_summary_model_pipeline(input_batch_content )[0]['generated_text']
|
| 164 |
#ner_labels = _inference_ner_spancat(input_batch_content ,summary, penalty = 0.8, limit_outputs=limit_companies)
|
| 165 |
df = pd.DataFrame(prob_outs,columns =['E','S','G'])
|
| 166 |
+
df['sent_lbl'] = [d['label'] for d in sentiment ]
|
| 167 |
+
df['sent_score'] = [d['score'] for d in sentiment ]
|
| 168 |
print("[i] Pandas output shape:",df.shape)
|
| 169 |
|
| 170 |
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
|