Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,7 +15,7 @@ def encode_image(image_path):
|
|
| 15 |
|
| 16 |
def mark_contours(image_path):
|
| 17 |
image = cv2.imread(image_path)
|
| 18 |
-
image = cv2.resize(image,
|
| 19 |
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
| 20 |
ret, binary = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY+cv2.THRESH_OTSU)
|
| 21 |
contours, hierarchy = cv2.findContours(binary, mode=cv2.RETR_TREE, method=cv2.CHAIN_APPROX_NONE)
|
|
@@ -29,7 +29,7 @@ def api_calling(image, prompt, api_key):
|
|
| 29 |
base64_image = encode_image(image)
|
| 30 |
if len(prompt) == 0:
|
| 31 |
# 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."
|
| 32 |
-
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
|
| 33 |
|
| 34 |
headers = {
|
| 35 |
"Content-Type": "application/json",
|
|
|
|
| 15 |
|
| 16 |
def mark_contours(image_path):
|
| 17 |
image = cv2.imread(image_path)
|
| 18 |
+
image = cv2.resize(image, None, fx=0.9,fy=0.9)
|
| 19 |
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
| 20 |
ret, binary = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY+cv2.THRESH_OTSU)
|
| 21 |
contours, hierarchy = cv2.findContours(binary, mode=cv2.RETR_TREE, method=cv2.CHAIN_APPROX_NONE)
|
|
|
|
| 29 |
base64_image = encode_image(image)
|
| 30 |
if len(prompt) == 0:
|
| 31 |
# 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."
|
| 32 |
+
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."
|
| 33 |
|
| 34 |
headers = {
|
| 35 |
"Content-Type": "application/json",
|