MCPcopy Create free account
hub / github.com/alpha2phi/python-apps / process_incoming_request

Function process_incoming_request

cartoon-camera/backend/main.py:60–76  ·  view source on GitHub ↗
(payload)

Source from the content-addressed store, hash-verified

58
59
60def process_incoming_request(payload):
61 parsed_data = json.loads(payload)
62 data = parsed_data["data"]
63 style = parsed_data["style"]
64
65 # Convert to PIL image
66 image = data[data.find(",") + 1:]
67 dec = base64.b64decode(image + "===")
68 image = Image.open(BytesIO(dec))
69
70 # Process the image
71 cartoon_img = cartoonify(image, style)
72
73 result = {
74 "output": base64_encode_img(cartoon_img),
75 }
76 return result
77
78
79@app.get("/")

Callers 1

process_cartoon_wsFunction · 0.85

Calls 2

cartoonifyFunction · 0.90
base64_encode_imgFunction · 0.70

Tested by

no test coverage detected