Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -212,6 +212,12 @@ def inference(input_batch,isurl,use_archive,limit_companies=10):
|
|
212 |
df['sent_lbl'] = [d['label'] for d in sentiment ]
|
213 |
df['sent_score'] = [d['score'] for d in sentiment ]
|
214 |
print("[i] Pandas output shape:",df.shape)
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
|
216 |
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
|
217 |
|
|
|
212 |
df['sent_lbl'] = [d['label'] for d in sentiment ]
|
213 |
df['sent_score'] = [d['score'] for d in sentiment ]
|
214 |
print("[i] Pandas output shape:",df.shape)
|
215 |
+
|
216 |
+
#[[], [('Nvidia', 'Information Technology')], [('Twitter', 'Communication Services'), ('Apple', 'Information Technology')], [], [], [], [], [], []]
|
217 |
+
for idx in range(len(df.index)):
|
218 |
+
if ner_labels[idx]: #not empty
|
219 |
+
for ner in ner_labels[idx]:
|
220 |
+
df = df.append(df.loc[[idx]].assign(company=ner[0], sector=ner[1]), ignore_index=True)
|
221 |
|
222 |
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
|
223 |
|