From ec51e9c76433b9e9498ade1dbe5de2268ad84218 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Mon, 11 Mar 2024 02:41:59 +0100 Subject: Fix HuggingChat and PerplexityLabs and add HuggingFace provider Add more models and image generation in You provider Use You as second default image provider --- g4f/Provider/bing/create_images.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'g4f/Provider/bing') diff --git a/g4f/Provider/bing/create_images.py b/g4f/Provider/bing/create_images.py index f6a8a372..cb357708 100644 --- a/g4f/Provider/bing/create_images.py +++ b/g4f/Provider/bing/create_images.py @@ -20,7 +20,7 @@ except ImportError: from ...providers.create_images import CreateImagesProvider from ..helper import get_connector from ...providers.types import ProviderType -from ...errors import MissingRequirementsError +from ...errors import MissingRequirementsError, RateLimitError from ...webdriver import WebDriver, get_driver_cookies, get_browser BING_URL = "https://www.bing.com" @@ -125,6 +125,8 @@ async def create_images(session: ClientSession, prompt: str, proxy: str = None, async with session.post(url, allow_redirects=False, data=payload, timeout=timeout) as response: response.raise_for_status() text = (await response.text()).lower() + if "0 coins available" in text: + raise RateLimitError("No coins left. Log in with a different account or wait a while") for error in ERRORS: if error in text: raise RuntimeError(f"Create images failed: {error}") -- cgit v1.2.3