import os import gradio as gr from src.brain import generate_answers processing = False def response(query, history): global processing processing = True output = generate_answers(query) history.append((query, output)) processing = False return "", history def loading(): return "Loading ..." with gr.Blocks(css=css) as app: with gr.Column(elem_id="column_container"): gr.HTML(title_html) chatbot = gr.Chatbot([], elem_id="chatbot") with gr.Column(): send = gr.Label(value="Write your QUESTION bellow and hit ENTER") query = gr.Textbox( label="Type your questions here:", placeholder="What do you want to know?", ) clear = gr.ClearButton([query, chatbot]) gr.HTML(bts_html) query.submit(response, [query, chatbot], [query, chatbot], queue=True) app.launch()