Update app.py
Browse files
app.py
CHANGED
@@ -59,20 +59,17 @@ def score_fincat(txt):
|
|
59 |
features = bert_embedding_extract(context_text, word)
|
60 |
if(features[0]=='None'):
|
61 |
highlight.append(('None', ' '))
|
62 |
-
|
63 |
-
headers = ['numeral', 'prediction', 'probability']
|
64 |
-
dff.columns = headers
|
65 |
-
return highlight, dff
|
66 |
prediction = lr_clf.predict(features.reshape(1, 768))
|
67 |
prediction_probability = '{:.4f}'.format(round(lr_clf.predict_proba(features.reshape(1, 768))[:,1][0], 4))
|
68 |
highlight.append((word, ' In-claim' if prediction==1 else 'Out-of-Claim'))
|
69 |
-
|
70 |
else:
|
71 |
highlight.append((word, ' '))
|
72 |
-
headers = ['numeral', 'prediction', 'probability']
|
73 |
-
dff = pd.DataFrame(li)
|
74 |
-
|
75 |
-
return highlight
|
76 |
|
77 |
|
78 |
##Summarization
|
@@ -143,7 +140,7 @@ def quad(query,file):
|
|
143 |
#stext = resp[0]['summary_text']
|
144 |
|
145 |
# highlight,dff=score_fincat(answer)
|
146 |
-
return answer,summarize_text(answer),get_sustainability(answer),fls(answer)
|
147 |
|
148 |
|
149 |
# b6 = gr.Button("Get Sustainability")
|
@@ -153,7 +150,7 @@ def quad(query,file):
|
|
153 |
#iface = gr.Interface(fn=get_sustainability, inputs="textbox", title="CONBERT",description="SUSTAINABILITY TOOL", outputs=gr.HighlightedText(), allow_flagging="never")
|
154 |
#iface.launch()
|
155 |
|
156 |
-
iface = gr.Interface(fn=quad, inputs=[gr.inputs.Textbox(label='SEARCH QUERY'),gr.inputs.File(label='TXT FILE')], title="CONBERT",description="SUSTAINABILITY TOOL",article='Article', outputs=[gr.outputs.Textbox(label='Answer'),gr.outputs.Textbox(label='Summary'),gr.HighlightedText(label='SUSTAINABILITY'),gr.HighlightedText(label='FLS')], allow_flagging="never")
|
157 |
|
158 |
|
159 |
iface.launch()
|
|
|
59 |
features = bert_embedding_extract(context_text, word)
|
60 |
if(features[0]=='None'):
|
61 |
highlight.append(('None', ' '))
|
62 |
+
return highlight
|
|
|
|
|
|
|
63 |
prediction = lr_clf.predict(features.reshape(1, 768))
|
64 |
prediction_probability = '{:.4f}'.format(round(lr_clf.predict_proba(features.reshape(1, 768))[:,1][0], 4))
|
65 |
highlight.append((word, ' In-claim' if prediction==1 else 'Out-of-Claim'))
|
66 |
+
# li.append([word,' In-claim' if prediction==1 else 'Out-of-Claim', prediction_probability])
|
67 |
else:
|
68 |
highlight.append((word, ' '))
|
69 |
+
#headers = ['numeral', 'prediction', 'probability']
|
70 |
+
#dff = pd.DataFrame(li)
|
71 |
+
# dff.columns = headers
|
72 |
+
return highlight
|
73 |
|
74 |
|
75 |
##Summarization
|
|
|
140 |
#stext = resp[0]['summary_text']
|
141 |
|
142 |
# highlight,dff=score_fincat(answer)
|
143 |
+
return answer,summarize_text(answer),score_fincat(answer),get_sustainability(answer),fls(answer)
|
144 |
|
145 |
|
146 |
# b6 = gr.Button("Get Sustainability")
|
|
|
150 |
#iface = gr.Interface(fn=get_sustainability, inputs="textbox", title="CONBERT",description="SUSTAINABILITY TOOL", outputs=gr.HighlightedText(), allow_flagging="never")
|
151 |
#iface.launch()
|
152 |
|
153 |
+
iface = gr.Interface(fn=quad, inputs=[gr.inputs.Textbox(label='SEARCH QUERY'),gr.inputs.File(label='TXT FILE')], title="CONBERT",description="SUSTAINABILITY TOOL",article='Article', outputs=[gr.outputs.Textbox(label='Answer'),gr.outputs.Textbox(label='Summary'),gr.outputs.Textbox(label='NER'),gr.HighlightedText(label='SUSTAINABILITY'),gr.HighlightedText(label='FLS')], allow_flagging="never")
|
154 |
|
155 |
|
156 |
iface.launch()
|