from langchain_src.qna_chain import generate_response import gradio as gr import time title = """

ChatIGL

""" description = """

This is a chat model, which can currently answer questions to IGL Docs provided.

""" with gr.Blocks(theme="glass") as demo: gr.HTML(title) chatbot = gr.Chatbot(type="messages", height=750) msg = gr.Textbox() clear = gr.ClearButton([msg, chatbot]) def respond(message, chat_history): bot_message = generate_response(message, chat_history) chat_history.append({"role": "user", "content": message}) chat_history.append({"role": "assistant", "content": bot_message}) return "", chat_history msg.submit(respond, [msg, chatbot], [msg, chatbot]) gr.Examples([ ["How should a MDPE pipe cross a Nallah?"], ["At what depth should a MDPE pipe be laid?"], ], inputs=msg, label= "Examples" ) gr.HTML(description) demo.launch()