Spaces:
Runtime error
Runtime error
Upload 3 files
Browse files- app.py +26 -0
- input.jpg +0 -0
- requirements.txt +3 -0
app.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import gradio as gr
|
| 3 |
+
from carbgremover.external_model import remove_background_external, plot_image
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def process(image):
|
| 7 |
+
res = remove_background_external(image_path='car1.jpg', device="cpu")
|
| 8 |
+
return res
|
| 9 |
+
|
| 10 |
+
gr.Markdown("## Car Segmentation")
|
| 11 |
+
gr.HTML('''
|
| 12 |
+
<p style="margin-bottom: 10px; font-size: 94%">
|
| 13 |
+
This is a demo for Car Segmentation that using
|
| 14 |
+
<a href="https://pypi.org/project/CarSegmentPro/" target="_blank">.
|
| 15 |
+
</p>
|
| 16 |
+
''')
|
| 17 |
+
title = "Background Removal"
|
| 18 |
+
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>
|
| 19 |
+
"""
|
| 20 |
+
examples = [['./input.jpg'],]
|
| 21 |
+
# output = ImageSlider(position=0.5,label='Image without background', type="pil", show_download_button=True)
|
| 22 |
+
# demo = gr.Interface(fn=process,inputs="image", outputs=output, examples=examples, title=title, description=description)
|
| 23 |
+
demo = gr.Interface(fn=process,inputs="image", outputs="image", examples=examples, title=title, description=description)
|
| 24 |
+
|
| 25 |
+
if __name__ == "__main__":
|
| 26 |
+
demo.launch(share=False)
|
input.jpg
ADDED
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
gradio_imageslider
|
| 3 |
+
CarSegmentPro==0.0.1
|