rdose commited on
Commit
4b77ec3
·
1 Parent(s): 7f2f508

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -15,7 +15,7 @@ import itertools
15
  MODEL_TRANSFORMER_BASED = "distilbert-base-uncased"
16
  MODEL_ONNX_FNAME = "ESG_classifier.onnx"
17
  MODEL_SENTIMENT_ANALYSIS = "ProsusAI/finbert"
18
- MODEL_SUMMARY_PEGASUS = "oMateos2020/pegasus-newsroom-cnn_full-adafactor-bs6"
19
 
20
 
21
 
@@ -40,9 +40,9 @@ def _inference_ner_spancat(text, summary, penalty=0.5, normalise=True, limit_out
40
 
41
  return dict(itertools.islice(sorted(comp_raw_text.items(), key=lambda x: x[1], reverse=True), limit_outputs))
42
 
43
- def _inference_summary_model_pipeline(text):
44
- pipe = pipeline("text2text-generation", model=MODEL_SUMMARY_PEGASUS)
45
- return pipe(text,truncation='longest_first')
46
 
47
  def _inference_sentiment_model_pipeline(text):
48
  tokenizer_kwargs = {'padding':True,'truncation':True,'max_length':512}#,'return_tensors':'pt'}
@@ -105,7 +105,7 @@ def _inference_classifier(text):
105
  # compute ONNX Runtime output prediction
106
  ort_outs = ort_session.run(None, input_feed=dict(inputs))
107
 
108
- return sigmoid(ort_outs[0])[0]
109
 
110
  def inference(input_batch,isurl,use_archive,limit_companies=10):
111
  input_batch_content = []
 
15
  MODEL_TRANSFORMER_BASED = "distilbert-base-uncased"
16
  MODEL_ONNX_FNAME = "ESG_classifier.onnx"
17
  MODEL_SENTIMENT_ANALYSIS = "ProsusAI/finbert"
18
+ #MODEL_SUMMARY_PEGASUS = "oMateos2020/pegasus-newsroom-cnn_full-adafactor-bs6"
19
 
20
 
21
 
 
40
 
41
  return dict(itertools.islice(sorted(comp_raw_text.items(), key=lambda x: x[1], reverse=True), limit_outputs))
42
 
43
+ #def _inference_summary_model_pipeline(text):
44
+ # pipe = pipeline("text2text-generation", model=MODEL_SUMMARY_PEGASUS)
45
+ # return pipe(text,truncation='longest_first')
46
 
47
  def _inference_sentiment_model_pipeline(text):
48
  tokenizer_kwargs = {'padding':True,'truncation':True,'max_length':512}#,'return_tensors':'pt'}
 
105
  # compute ONNX Runtime output prediction
106
  ort_outs = ort_session.run(None, input_feed=dict(inputs))
107
 
108
+ return sigmoid(ort_outs[0])
109
 
110
  def inference(input_batch,isurl,use_archive,limit_companies=10):
111
  input_batch_content = []