MCPcopy
hub / github.com/XingangPan/DragGAN / on_click_enable_draw

Function on_click_enable_draw

visualizer_drag_gradio.py:731–744  ·  view source on GitHub ↗

Function to start add mask mode. 1. Preprocess mask info from last state 2. Change editing state to add_mask 3. Set curr image with points and mask

(global_state, image)

Source from the content-addressed store, hash-verified

729
730 # Image
731 def on_click_enable_draw(global_state, image):
732 """Function to start add mask mode.
733 1. Preprocess mask info from last state
734 2. Change editing state to add_mask
735 3. Set curr image with points and mask
736 """
737 global_state = preprocess_mask_info(global_state, image)
738 global_state['editing_state'] = 'add_mask'
739 image_raw = global_state['images']['image_raw']
740 image_draw = update_image_draw(image_raw, global_state['points'],
741 global_state['mask'], True,
742 global_state)
743 return (global_state,
744 gr.Image.update(value=image_draw, interactive=True))
745
746 def on_click_remove_draw(global_state, image):
747 """Function to start remove mask mode.

Callers

nothing calls this directly

Calls 3

preprocess_mask_infoFunction · 0.85
update_image_drawFunction · 0.85
updateMethod · 0.45

Tested by

no test coverage detected