Hi,
Do you have any solution to the following issue
that may have started only because something at huggingface changed something
HTTPError: 401 Client Error: PermissionDenied for url: https://huggingface.co/api/experimental/images/search?q=fringe+selfie&license=public&imageType=photo&count=150
How to rewrite this code to overcome the error?
The following is the codes the gives the error
type SEARCH_URL = "https://huggingface.co/api/experimental/images/search"
def get_image_urls_by_term(search_term: str, count=150):
params = {"q": search_term, "license": "public", "imageType": "photo", "count": count}
response = requests.get(SEARCH_URL, params=params)
response.raise_for_status()
response_data = response.json()
image_urls = [img['thumbnailUrl'] for img in response_data['value']]
return image_urlsor paste code here
Can we replace the above code with other license free and authentication free image sources
Regards.