Server Mode

BMF also supports pre-built modes. The following example shows server initialization and usage:

from bmf import ServerGateway

server_gateway = ServerGateway(graph)

Before Server processing, build the packet first:

packet1 = Packet()
video_info_list1 = [{'input_path': input_video_path_1}]
packet1.set_data({'type': InputType.VIDEO, 'input_path': video_info_list1})

After that, a thread is generated and the packet is sent to the server graph:

thread_ = threading.Thread(target=process_thread, args=(server_gateway, packet1))

If you need the complete code, you can refer to

Last modified February 19, 2024 : fix baidu statistics (daa0758)