import gradio as gr import torch from .segmentation import InteractiveSegmentationInterface _HEADER = """

GraCo: Granularity-Cotrollable Interactive Segmentation

""" #

# # # # # #

class GraCoWebApplication(object): def __init__(self, device: torch.device = None): if device is None: device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') with gr.Blocks() as self._blocks: gr.Markdown(_HEADER) with gr.Tab('Granularity-Cotrollable Interactive Segmentation'): InteractiveSegmentationInterface(device=device) def launch(self): self._blocks.launch()