Nechba's picture
Upload 3 files
7c351c4 verified
import gradio as gr
from carbgremover.external_model import remove_background_external, plot_image
def process(image):
res = remove_background_external(image_path='car1.jpg', device="cpu")
return res
gr.Markdown("## Car Segmentation")
gr.HTML('''
<p style="margin-bottom: 10px; font-size: 94%">
This is a demo for Car Segmentation that using
<a href="https://pypi.org/project/CarSegmentPro/" target="_blank">.
</p>
''')
title = "Background Removal"
description = r"""The CarSegmentPro package is developed to facilitate the removal of both internal and external backgrounds from car images. Read more at model card <a href='https://pypi.org/project/CarSegmentPro/' target='_blank'></a>.<br>
"""
examples = [['./input.jpg'],]
# output = ImageSlider(position=0.5,label='Image without background', type="pil", show_download_button=True)
# demo = gr.Interface(fn=process,inputs="image", outputs=output, examples=examples, title=title, description=description)
demo = gr.Interface(fn=process,inputs="image", outputs="image", examples=examples, title=title, description=description)
if __name__ == "__main__":
demo.launch(share=False)