Spaces:
Runtime error
Runtime error
File size: 650 Bytes
6f49966 2b6c2bd 6f49966 2b6c2bd 6f49966 2b6c2bd 6f49966 2b6c2bd 6f49966 |
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 |
import gradio as gr
import numpy as np
from sam_segment import predict_masks_with_sam
from lama_inpaint import inpaint_img_with_lama
from utils import load_img_to_array, save_array_to_img, dilate_mask, \
show_mask, show_points
with gr.Blocks() as demo:
with gr.Row():
input_img = gr.Image(label="Input")
output_img = gr.Image(label="Selected Segment")
with gr.Row():
h = gr.Number()
w = gr.Number()
def get_select_coords(img, evt: gr.SelectData):
return evt.index[1], evt.index[0]
input_img.select(get_select_coords, [input_img,], [h, w])
if __name__ == "__main__":
demo.launch() |