Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -111,6 +111,7 @@ def _inference_classifier(text):
|
|
111 |
return sigmoid(ort_outs[0])
|
112 |
|
113 |
def inference(input_batch,isurl,use_archive,limit_companies=10):
|
|
|
114 |
input_batch_content = []
|
115 |
# if file_in.name is not "":
|
116 |
# print("[i] Input is file:",file_in.name)
|
@@ -136,6 +137,7 @@ def inference(input_batch,isurl,use_archive,limit_companies=10):
|
|
136 |
url = row_in[0]
|
137 |
else:
|
138 |
url = row_in
|
|
|
139 |
if use_archive:
|
140 |
archive = is_in_archive(url)
|
141 |
if archive['archived']:
|
@@ -163,6 +165,10 @@ def inference(input_batch,isurl,use_archive,limit_companies=10):
|
|
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)
|
|
|
111 |
return sigmoid(ort_outs[0])
|
112 |
|
113 |
def inference(input_batch,isurl,use_archive,limit_companies=10):
|
114 |
+
url_list = [] #Only used if isurl
|
115 |
input_batch_content = []
|
116 |
# if file_in.name is not "":
|
117 |
# print("[i] Input is file:",file_in.name)
|
|
|
137 |
url = row_in[0]
|
138 |
else:
|
139 |
url = row_in
|
140 |
+
url_list.append(url)
|
141 |
if use_archive:
|
142 |
archive = is_in_archive(url)
|
143 |
if archive['archived']:
|
|
|
165 |
#summary = _inference_summary_model_pipeline(input_batch_content )[0]['generated_text']
|
166 |
#ner_labels = _inference_ner_spancat(input_batch_content ,summary, penalty = 0.8, limit_outputs=limit_companies)
|
167 |
df = pd.DataFrame(prob_outs,columns =['E','S','G'])
|
168 |
+
if isurl:
|
169 |
+
df['URL'] = url_list
|
170 |
+
else:
|
171 |
+
df['content_id'] = range(1, len(input_batch_r)+1)
|
172 |
df['sent_lbl'] = [d['label'] for d in sentiment ]
|
173 |
df['sent_score'] = [d['score'] for d in sentiment ]
|
174 |
print("[i] Pandas output shape:",df.shape)
|