Spaces:
Runtime error
Runtime error
Update app.py
Browse files14 unmodified lines151617181920217 unmodified lines2930313233343514 unmodified linesdef mark_contours(image_path):image = cv2.imread(image_path)image = cv2.resize(image, (0, 0), fx = 0.5, fy = 0.5)gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)ret, binary = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY+cv2.THRESH_OTSU)contours, hierarchy = cv2.findContours(binary, mode=cv2.RETR_TREE, method=cv2.CHAIN_APPROX_NONE)7 unmodified linesbase64_image = encode_image(image)if len(prompt) == 0:# prompt = "I want you to act as my friend. I will share images with you and ask about my queries related to the images and you will reply to me with the explanation of the image with accuracy, compassion and in conversational manor. I want you to keep the reply neat, limiting the reply to 200 words in English."prompt = "I want you to act as a friendly tile setters who has 10 years of experience with floor tiling. I will share an image of floor with you and you will reply to me with the number of tiles that need cleaning, if tiles appear clean then you can reply with the fixed answer 'All tiles are clean'. Reply with accuracy and compassion. I want you to keep the reply neat, limiting the reply to 25 words in English."headers = {"Content-Type": "application/json",14 unmodified lines151617181920217 unmodified lines2930313233343514 unmodified linesdef mark_contours(image_path):image = cv2.imread(image_path)image = cv2.resize(image, None, fx=0.9,fy=0.9)gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)ret, binary = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY+cv2.THRESH_OTSU)contours, hierarchy = cv2.findContours(binary, mode=cv2.RETR_TREE, method=cv2.CHAIN_APPROX_NONE)7 unmodified linesbase64_image = encode_image(image)if len(prompt) == 0:# prompt = "I want you to act as my friend. I will share images with you and ask about my queries related to the images and you will reply to me with the explanation of the image with accuracy, compassion and in conversational manor. I want you to keep the reply neat, limiting the reply to 200 words in English."prompt = "I want you to act as a friendly tile setters who has 10 years of experience with floor tiling. I will share an image of floor with you and you will reply to me with the number of tiles that need cleaning, if tiles appear clean then you can reply with the fixed answer 'All tiles are clean'. Reply with accuracy and compassion. I want you to keep the reply neat, limiting the reply to 40 words in English."headers = {"Content-Type": "application/json",
app.py+2-2