mirror of
https://github.com/wassname/IndicoIo-python.git
synced 2026-08-12 11:40:34 +08:00
routing around image_preprocessing for urls
This commit is contained in:
@@ -14,7 +14,7 @@ def api_handler(arg, cloud, api, batch=False, auth=None, **kwargs):
|
||||
|
||||
if cloud:
|
||||
host = "%s.indico.domains" % cloud
|
||||
else:
|
||||
else:
|
||||
# default to indico public cloud
|
||||
host = config.PUBLIC_API_HOST
|
||||
|
||||
@@ -142,3 +142,13 @@ def image_preprocess(image, batch=False):
|
||||
image = resize(image,(64,64))
|
||||
image = image.tolist()
|
||||
return image
|
||||
|
||||
|
||||
def is_url(data, batch=False):
|
||||
if batch and isinstance(data[0], basestring):
|
||||
return True
|
||||
if not batch and isinstance(data, basestring):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
from indicoio.utils import is_url
|
||||
|
||||
def test_is_urls():
|
||||
boring_image = [0]*(32**2)
|
||||
boring_images = [boring_image]*100
|
||||
|
||||
assert not is_url(boring_image, batch=False)
|
||||
assert not is_url(boring_images, batch=True)
|
||||
|
||||
url = 'http://picturepicture.com/picture'
|
||||
urls = [url]*100
|
||||
|
||||
assert is_url(url, batch=False)
|
||||
assert is_url(urls, batch=True)
|
||||
|
||||
Reference in New Issue
Block a user