Spaces:
GIZ
/
Running on CPU Upgrade

prashant commited on
Commit
1a4b146
1 Parent(s): 1d77594

haystackdoc adaptation

Browse files
Files changed (1) hide show
  1. udfPreprocess/sdg_classifier.py +7 -4
udfPreprocess/sdg_classifier.py CHANGED
@@ -51,12 +51,15 @@ def sdg_classification(paraList:List[Text])->Tuple[DataFrame,Series]:
51
 
52
 
53
  classifier = load_sdgClassifier()
54
- labels = classifier(paraList)
 
55
 
56
- labels_= [(l['label'],l['score']) for l in labels]
57
- df = DataFrame(labels_, columns=["SDG", "Relevancy"])
 
 
58
 
59
- df['text'] = paraList
60
  df = df.sort_values(by="Relevancy", ascending=False).reset_index(drop=True)
61
  df.index += 1
62
  df =df[df['Relevancy']>threshold]
 
51
 
52
 
53
  classifier = load_sdgClassifier()
54
+ results = classifier.predict(paraList)
55
+
56
 
57
+ labels_= [(l.meta['classification']['label'],
58
+ l.meta['classification']['score'],l.content,) for l in results]
59
+
60
+ df = DataFrame(labels_, columns=["text","SDG","Relevancy"])
61
 
62
+ # df['text'] = paraList
63
  df = df.sort_values(by="Relevancy", ascending=False).reset_index(drop=True)
64
  df.index += 1
65
  df =df[df['Relevancy']>threshold]