import gradio as gr def load_questions(): questions = [] with open('questionshort.txt') as f: questions = f.readlines() return questions questions = load_questions() def con(file): with open(file.name) as f: text = f.read() return text demo = gr.Blocks() with demo: txt_file = gr.File(type="txt",label='CONTRACT') text = gr.Textbox(lines=10) selected_ques=gr.Dropdown(choices=questions,label='SEARCH QUERY') b1 = gr.Button("Analyze File") b1.click(con, inputs=txt_file, outputs=text) demo.launch()