Update app.py
Browse files
app.py
CHANGED
@@ -59,7 +59,9 @@ def score_fincat(txt):
|
|
59 |
features = bert_embedding_extract(context_text, word)
|
60 |
if(features[0]=='None'):
|
61 |
highlight.append(('None', ' '))
|
62 |
-
dff = pd.DataFrame(['None'])
|
|
|
|
|
63 |
return highlight, dff
|
64 |
prediction = lr_clf.predict(features.reshape(1, 768))
|
65 |
prediction_probability = '{:.4f}'.format(round(lr_clf.predict_proba(features.reshape(1, 768))[:,1][0], 4))
|
@@ -141,7 +143,7 @@ def quad(query,file):
|
|
141 |
#stext = resp[0]['summary_text']
|
142 |
|
143 |
# highlight,dff=score_fincat(answer)
|
144 |
-
return answer,summarize_text(answer),
|
145 |
|
146 |
|
147 |
# b6 = gr.Button("Get Sustainability")
|
@@ -151,7 +153,7 @@ def quad(query,file):
|
|
151 |
#iface = gr.Interface(fn=get_sustainability, inputs="textbox", title="CONBERT",description="SUSTAINABILITY TOOL", outputs=gr.HighlightedText(), allow_flagging="never")
|
152 |
#iface.launch()
|
153 |
|
154 |
-
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='
|
155 |
|
156 |
|
157 |
iface.launch()
|
|
|
59 |
features = bert_embedding_extract(context_text, word)
|
60 |
if(features[0]=='None'):
|
61 |
highlight.append(('None', ' '))
|
62 |
+
dff = pd.DataFrame([['None', 'None', 'None'])
|
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))
|
|
|
143 |
#stext = resp[0]['summary_text']
|
144 |
|
145 |
# highlight,dff=score_fincat(answer)
|
146 |
+
return answer,summarize_text(answer),score_fincat(answer),get_sustainability(answer),fls(answer)
|
147 |
|
148 |
|
149 |
# b6 = gr.Button("Get Sustainability")
|
|
|
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='Claims'),gr.HighlightedText(label='SUSTAINABILITY'),gr.HighlightedText(label='FLS')], allow_flagging="never")
|
157 |
|
158 |
|
159 |
iface.launch()
|