Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -19,10 +19,10 @@ def validate_item(item_id: str, use_title: bool, threshold: float):
|
|
19 |
def validate_images(img_url_1, img_url_2, img_url_3, domain: str, title: str, threshold: float):
|
20 |
img_urls = [url for url in [img_url_1, img_url_2, img_url_3] if url != ""]
|
21 |
site, domain = domain.split("-")
|
22 |
-
|
23 |
if title == "":
|
24 |
title = None
|
25 |
-
|
26 |
valid_images = [x for i, x in enumerate(images) if valid_probas[i].squeeze() >= threshold]
|
27 |
invalid_images = [x for i, x in enumerate(images) if valid_probas[i].squeeze() < threshold]
|
28 |
return f"## Domain: {domain}", valid_images, invalid_images
|
|
|
19 |
def validate_images(img_url_1, img_url_2, img_url_3, domain: str, title: str, threshold: float):
|
20 |
img_urls = [url for url in [img_url_1, img_url_2, img_url_3] if url != ""]
|
21 |
site, domain = domain.split("-")
|
22 |
+
domain_text = domain.replace("_", " ").lower()
|
23 |
if title == "":
|
24 |
title = None
|
25 |
+
probas, valid_probas, invalid_probas = detector.predict_probas_url(img_urls, domain_text, site, title)
|
26 |
valid_images = [x for i, x in enumerate(images) if valid_probas[i].squeeze() >= threshold]
|
27 |
invalid_images = [x for i, x in enumerate(images) if valid_probas[i].squeeze() < threshold]
|
28 |
return f"## Domain: {domain}", valid_images, invalid_images
|