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()