File size: 1,158 Bytes
7c351c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

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)