Upload app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import torch
|
| 3 |
+
from score_fincat import score_fincat
|
| 4 |
+
from sus_fls import get_sustainability,fls
|
| 5 |
+
from Cuad_others import quad,summarize_text,fin_ner
|
| 6 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
#CUAD STARTS
|
| 10 |
+
def load_questions():
|
| 11 |
+
questions = []
|
| 12 |
+
with open('questions.txt') as f:
|
| 13 |
+
questions = f.readlines()
|
| 14 |
+
return questions
|
| 15 |
+
questions = load_questions()
|
| 16 |
+
|
| 17 |
+
def mainFun(query,file):
|
| 18 |
+
answer,answer_p=quad(query,file.name)
|
| 19 |
+
return answer_p,summarize_text(answer),fin_ner(answer),score_fincat(answer),get_sustainability(answer),fls(answer)
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
iface = gr.Interface(fn=mainFun, inputs=[gr.Dropdown(choices=questions,label='SEARCH QUERY'),gr.inputs.File(label='TXT FILE')], title="CONBERT",description="CONTRACT REVIEW 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")
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
iface.launch()
|