MCPcopy Create free account
hub / github.com/MatrixTeam-AI/RAIN / transform_func

Function transform_func

gradio_app.py:40–63  ·  view source on GitHub ↗
(frame)

Source from the content-addressed store, hash-verified

38)
39
40def transform_func(frame):
41 global timestamp
42 global res
43 if not(a.work_flag):
44 return res
45 h, w = frame.shape[:2]
46 d = int(min(h, w) * cropping)
47 mh = (h - d) // 2
48 mw = (w - d) // 2
49
50 frame = frame[mh:h-mh,mw:w-mw,:]
51 if(webrtc_mode):
52 frame = frame[:,:,::-1]
53 a.push_input(frame)
54 current_timestamp = time.time()
55 if(current_timestamp - timestamp >= 1.0 / (a.fps + len(a.output_pile) * 2 )):
56 u = a.fetch_one_frame()
57 if not (u is None):
58 res = u
59 if (webrtc_mode):
60 res = (255.0 * res).astype(np.uint8)
61 res = cv2.cvtColor(res, cv2.COLOR_RGB2BGR)
62 timestamp = current_timestamp
63 return res
64
65def fuse_ref(img):
66 if(a.vae is None):

Callers

nothing calls this directly

Calls 2

push_inputMethod · 0.80
fetch_one_frameMethod · 0.80

Tested by

no test coverage detected