Hi, I am running a gradio inside a fastapi instance, all containerized in docker.
In local, everything works perfectly.
However, on ECS: the code breaks when calling the function bot:
def create_block(base_url):
def user(user_message, history):
if user_message == '':
user_message = 'Introduce yourself'
return "", [['a', 'b']] #up to here it works
# return "", history + [[user_message, None]]
def bot(history, consultant_name): ###NOT WORKING
yield [['v1', 'v2']] #on ECS, it keeps returning [['a', 'b']], and this function is ignored
with gr.Blocks() as block:
base_url = gr.Variable(value=base_url)
consultant_name = gr.Variable(value='abc')
chatbot = gr.Chatbot()
msg = gr.Textbox()
msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(bot, [chatbot, consultant_name], chatbot)
# clear.click(lambda: None, None, chatbot, queue=False)
return block.queue()
app = gr.mount_gradio_app(app, create_block(base_url=base_url), path="/")
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=5000) #ssl_keyfile=ssl_keyfile, ssl_certfile=ssl_certfile
Does ECS have problem with queue(), perhaps? That is the only thing I can be thinking of
Thank you