rxavier commited on
Commit
31e18ef
1 Parent(s): 385ab0d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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
- domain = domain.replace("_", " ").lower()
23
  if title == "":
24
  title = None
25
- images, domain, probas, valid_probas, invalid_probas = detector.predict_probas_url(img_urls, domain, 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
 
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