Update app.py
Browse files12 unmodified lines1314151617181920203 unmodified lines2242252262272282292302312322332342352363 unmodified lines24024124224324424524683 unmodified lines33033133233333433533633733812 unmodified linesfrom huggingface_hub import hf_hub_downloadimg = np.zeros((96, 128))fp0 = "0.png"imsave(fp0, img)# data retrievaldef download_weights():203 unmodified linesflows = flows.resize((Lx, Ly), resample = Image.BICUBIC)fname_out = os.path.splitext(filepath[-1])[0]+"_outlines.png"try:os.remove(fname_out)except:print('not there')outpix.save(fname_out) #"outlines.png")print(fname_out)fname_flows = os.path.splitext(filepath[-1])[0]+"_flows.png"flows.save(fname_flows) #"outlines.png")3 unmodified linesb1 = gr.DownloadButton(visible=True, value = fname_masks)b2 = gr.DownloadButton(visible=True, value = fname_out) #"outlines.png")return fname_out, fname_flows, b1, b2# Gradio Interface#iface = gr.Interface(83 unmodified linesdown_btn2 = gr.DownloadButton("Download outlines (PNG)", visible=False)with gr.Column(scale=2):outlines = gr.Image(label = "Outlines", type = "filepath", format = 'png', value = fp0) #, width = "50vw", height = "20vw")#img_overlay = gr.Image(label = "Overlay", type = "pil", format = 'png') #, width = "50vw", height = "20vw")flows = gr.Image(label = "Cellpose flows", type = "filepath", format = 'png', value = fp0) #, width = "50vw", height = "20vw")12 unmodified lines131415161718192021203 unmodified lines2252262272282292302312323 unmodified lines23623723823924024124283 unmodified lines32632732832933033133233333412 unmodified linesfrom huggingface_hub import hf_hub_downloadimg = np.zeros((96, 128))fp0 = Image.fromarray(img)#fp0 = "0.png"#imsave(fp0, img)# data retrievaldef download_weights():203 unmodified linesflows = flows.resize((Lx, Ly), resample = Image.BICUBIC)fname_out = os.path.splitext(filepath[-1])[0]+"_outlines.png"outpix.save(fname_out) #"outlines.png")fname_flows = os.path.splitext(filepath[-1])[0]+"_flows.png"flows.save(fname_flows) #"outlines.png")3 unmodified linesb1 = gr.DownloadButton(visible=True, value = fname_masks)b2 = gr.DownloadButton(visible=True, value = fname_out) #"outlines.png")return outpix, flows, b1, b2# Gradio Interface#iface = gr.Interface(83 unmodified linesdown_btn2 = gr.DownloadButton("Download outlines (PNG)", visible=False)with gr.Column(scale=2):outlines = gr.Image(label = "Outlines", type = "pil", format = 'png', value = fp0) #, width = "50vw", height = "20vw")#img_overlay = gr.Image(label = "Overlay", type = "pil", format = 'png') #, width = "50vw", height = "20vw")flows = gr.Image(label = "Cellpose flows", type = "pil", format = 'png', value = fp0) #, width = "50vw", height = "20vw")
app.py+7-11