Download app.py from VoxlDev/DSEG: direct link, hf CLI and curl.
- Browser
- Download file 527 Bytes
-
https://huggingface.co/spaces/VoxlDev/DSEG/resolve/main/app.py
- Command line
-
hf download hf://spaces/VoxlDev/DSEG/app.py
-
curl -L -o app.py https://huggingface.co/spaces/VoxlDev/DSEG/resolve/main/app.py
527 Bytes
| import gradio as gr | |
| from PIL import Image | |
| from fastapi import FastAPI | |
| from process import Segment | |
| import numpy as np | |
| app = FastAPI() | |
| def process_image(input_image): | |
| if not isinstance(input_image, Image.Image): | |
| input_image = Image.fromarray(input_image.astype('uint8'), 'RGB') | |
| output_image = Segment(input_image, [0, 0, 0]) | |
| return output_image | |
| iface = gr.Interface( | |
| fn=process_image, | |
| inputs=gr.components.Image(type="numpy"), | |
| outputs=gr.components.Image(type="numpy") | |
| ) | |
| iface.launch() | |