Rovar2000Original post
Rank 2: Process
i'm kinda new in python and i wanna know why i can't run this cloud function in my self-hosted appwrite cloud function.
this is my code for image processing, it works on locale runs but i don't know how to make it work on cloud.
import cv2
import dlib
import numpy as np
import pytesseract
from PIL import Image
# Load the detector
detector = dlib.get_frontal_face_detector()
def extract_face(image_path, output_path, padding=35):
# Load the image
img = cv2.imread(image_path)
# Convert to grayscale
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# Use the detector to find faces
faces = detector(gray)
for i, face in enumerate(faces):
# Extract the face with some padding to make the image larger
x1, y1, x2, y2 = face.left() - padding, face.top() - padding, face.right() + padding, face.bottom() + padding
# Ensure the coordinates are within the image boundaries
x1, y1 = max(0, x1), max(0, y1)
x2, y2 = min(img.shape[1]-1, x2), min(img.shape[0]-1, y2)
# Crop the face out of the image
crop = img[y1:y2, x1:x2]
return crop
In the console in the appwrite self-host it logs
Docker Error: tar: short read
Summary
Developers are facing issues running a cloud function in self-hosted Appwrite. The issue might be due to an error in the Docker build process. The provided code for image processing seems to work in local runs but not on the cloud. Check the Docker logs for errors like "tar: short read" which could be causing the problem.