Shredder commited on
Commit
7574f0c
1 Parent(s): 4bc07c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -100,7 +100,7 @@ def fls(text):
100
  ner=pipeline('ner',model='Jean-Baptiste/camembert-ner-with-dates',tokenizer='Jean-Baptiste/camembert-ner-with-dates', aggregation_strategy="simple")
101
  def fin_ner(text):
102
  replaced_spans = ner(text)
103
- return replaced_spans
104
 
105
 
106
  #CUAD STARTS
@@ -133,14 +133,14 @@ def quad(query,file):
133
  data = json.load(jf)
134
  for i in range(1):
135
  raw_answer=data['0'][i]['text']
136
- answer += f"Answer {i+1}: {data['0'][i]['text']} -- \n"
137
  answer += f"Probability: {round(data['0'][i]['probability']*100,1)}%\n\n"
138
  #summarizer = pipeline("summarization", model="knkarthick/MEETING_SUMMARY")
139
  #resp = summarizer(answer)
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,7 +150,7 @@ def quad(query,file):
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.HighlightedText(label='CLAIM'),gr.HighlightedText(label='SUSTAINABILITY'),gr.HighlightedText(label='FLS')], allow_flagging="never")
154
 
155
 
156
  iface.launch()
 
100
  ner=pipeline('ner',model='Jean-Baptiste/camembert-ner-with-dates',tokenizer='Jean-Baptiste/camembert-ner-with-dates', aggregation_strategy="simple")
101
  def fin_ner(text):
102
  replaced_spans = ner(text)
103
+ return {"text": text, "entities": replaced_spans}
104
 
105
 
106
  #CUAD STARTS
 
133
  data = json.load(jf)
134
  for i in range(1):
135
  raw_answer=data['0'][i]['text']
136
+ answer += f"{data['0'][i]['text']} -- \n"
137
  answer += f"Probability: {round(data['0'][i]['probability']*100,1)}%\n\n"
138
  #summarizer = pipeline("summarization", model="knkarthick/MEETING_SUMMARY")
139
  #resp = summarizer(answer)
140
  #stext = resp[0]['summary_text']
141
 
142
  # highlight,dff=score_fincat(answer)
143
+ return answer,summarize_text(answer),fin_ner(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.HighlightedText(label='NER'),gr.HighlightedText(label='CLAIM'),gr.HighlightedText(label='SUSTAINABILITY'),gr.HighlightedText(label='FLS')], allow_flagging="never")
154
 
155
 
156
  iface.launch()