直接上代码:
def method_a(progress = gr.Progress(track_tqdm=True)): pool = multiprocessing.Pool(multiprocessing.cpu_count()) param_v = range(10) pbar = tqdm(total=len(param_v)) resy = [] for p in param_v: pool.apply_async(task_deal, callback=lambda _: pbar.update(1)) # resy.append(res) pool.close() pool.join() pbar.close()
主要步骤就是设置gr.Progress(track_tqdm=True),用于追踪tqdm
标签:tqdm,resy,进度条,gradio,param,pbar,进程,pool From: https://www.cnblogs.com/chentiao/p/17703113.html