import gradio as gr from dotenv import load_dotenv import os from agent import QMLAgent load_dotenv() agent = QMLAgent() with gr.Blocks(theme='snehilsanyal/scikit-learn') as demo: #with gr.Tab("QA"): chatbot = gr.Chatbot(label="QML Class Conversation Agent Demo") msg = gr.Textbox() clear = gr.Button("Clear") def respond(user_message, chat_history):#, progress=gr.Progress()): global agent bot_message = agent.run(user_message) chat_history.append((user_message, bot_message)) return "", chat_history msg.submit(respond, [msg, chatbot], [msg, chatbot]) clear.click(lambda: None, None, chatbot, queue=False) db_login = { os.environ["USER_NAME"]: os.environ["USER_PWD"] } def _myauth(username, password): if db_login.get(username) == password: return True return False #demo.queue(concurrency_count=10).launch(server_port=7860, server_name='0.0.0.0') demo.queue(concurrency_count=10).launch(auth=_myauth, server_port=7860, server_name='0.0.0.0')