Spaces:
Running
on
Zero
how to get transparent background?
i only get black background
Thanks for the suggestion. I just updated the codes, and all the results you can obtain from all tabs are in RGBA png images.
Thanks for the suggestion. I just updated the codes, and all the results you can obtain from all tabs are in RGBA png images.
大佬,我刚才在本地运行app_local.py,测试后发现,只有第3个tab批处理图片的下载结果是png格式,另外2个tab的下载结果都是webp格式,看起来不是透明背景的。大佬有空可以看下这个问题,其他效果都非常棒,批处理很实用!给大佬点赞!
Thanks for the suggestion. I just updated the codes, and all the results you can obtain from all tabs are in RGBA png images.
大佬,我刚才在本地运行app_local.py,测试后发现,只有第3个tab批处理图片的下载结果是png格式,另外2个tab的下载结果都是webp格式,看起来不是透明背景的。大佬有空可以看下这个问题,其他效果都非常棒,批处理很实用!给大佬点赞!
大佬,我尝试修改了下您这边的代码,在output中强制限定了前2个tab的图片输出格式为png,目前有效,所以跟大佬你说下。
tab_image = gr.Interface(
fn=predict,
inputs=[
gr.Image(label='Upload an image'),
gr.Textbox(lines=1, placeholder="Type the resolution (WxH
) you want, e.g., 1024x1024
. Higher resolutions can be much slower for inference.", label="Resolution"),
gr.Radio(list(usage_to_weights_file.keys()), value='General', label="Weights", info="Choose the weights you want.")
],
outputs=gr.Image(label="BiRefNet's prediction", type="pil", format="png"), # 添加 format='png'
examples=examples,
api_name="image",
description=descriptions,
)
tab_text = gr.Interface(
fn=predict,
inputs=[
gr.Textbox(label="Paste an image URL"),
gr.Textbox(lines=1, placeholder="Type the resolution (WxH
) you want, e.g., 1024x1024
. Higher resolutions can be much slower for inference.", label="Resolution"),
gr.Radio(list(usage_to_weights_file.keys()), value='General', label="Weights", info="Choose the weights you want.")
],
outputs=gr.Image(label="BiRefNet's prediction", type="pil", format="png"), # 添加 format='png'
examples=examples_url,
api_name="text",
description=descriptions+'\nTab-URL is partially modified from https://huggingface.co./spaces/not-lain/background-removal, thanks to this great work!',
)
Hello, 非常感谢哈! 那我现在就修改一下. 就是两处gr.Image(..., format='png')
就可以了是吧?
还有一个, 就是online的是ImageSlider, 我去找了下似乎它没有指定format的选项, 别人有交这方面的PR, 但还没被merge.
Hello, 非常感谢哈! 那我现在就修改一下. 就是两处
gr.Image(..., format='png')
就可以了是吧?
是的。
还有一个, 就是online的是ImageSlider, 我去找了下似乎它没有指定format的选项, 别人有交这方面的PR, 但还没被merge.
好的,那可以再等等的。我一般都是本地运行这些项目,可以大量使用,Huggingface上在线用每天貌似有次数限制,呜呜
这样的呀, 这我还不知道呢. 本地推理的话, 其实你可以用我github仓库里的tutorials/BiRefNet_inference.ipynb
, 可能也很方便.