it freezes when you send a Request: Image processing function async def processimages():…
- User
it freezes when you send a Request:
Image processing function
async def process_images(): global SERVER_RESPONSE, TASK_STATUS, check_weight, long_time_no_seen, adress last_frame_change_time = datetime.now() last_active = datetime.now() combined_result = [] failed_frames = 0 support = 0 try: TASK_STATUS = "In progress" logging.info("The process started") print("started") url = f"{adress}/shot.jpg" header = {type} # frame = cv2.imread("combined_area.png") # url = "http://192.168.127.124:8080/video" # cap = cv2.VideoCapture(url) img_resp = requests.get(url) img_arr = np.frombuffer(img_resp.content, np.uint8) frame = cv2.imdecode(img_arr, -1) print("hey") header = { "Content-Type": "multipart/form-data", } data = { "image": frame, }
response = requests.post( "http://localhost:8000/api/phone/camera", data=data, headers=header, ) print("wey") print(response.text) combined_result = response.text if "-" in combined_result: combined_result = combined_result.replace("-", ".") hey_there = await generate_audio(combined_result, True) print(f"{hey_there}") await audio_manager.play_audio_async("audio.mp3") print(f"combined: {combined_result}") await update_csv(combined_result, check_weight, True) # url = "http://10.30.225.127:8080/shot.jpg" # ret, frame = await capture_frame_async(cap) - Assistant