File size: 1,111 Bytes
10f176f
 
4b31fb8
1330102
b6cb8b5
10f176f
 
 
 
 
 
1cb88bb
10f176f
 
 
4b31fb8
b6cb8b5
 
 
10f176f
 
35d43f7
10f176f
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import gradio as gr
import torch
from score_fincat import score_fincat
from sus_fls import get_sustainability,fls
from Cuad_others import quad,summarize_text,fin_ner
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

     
#CUAD STARTS    
def load_questions():
    questions = []
    with open('questionshort.txt') as f:
        questions = f.readlines()
    return questions
questions = load_questions()

def mainFun(query,file):
    answer,answer_p=quad(query,file.name)
    return answer_p,summarize_text(answer),fin_ner(answer),score_fincat(answer),get_sustainability(answer),fls(answer)
                
                   
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")


iface.launch()