Spaces:
Running
Running
Merge pull request #87 from barun-saha/visual
Browse filesDisplay a helpful message on HF inference quota exhaustion error
app.py
CHANGED
@@ -367,13 +367,27 @@ def set_up_chat_ui():
|
|
367 |
True
|
368 |
)
|
369 |
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
except Exception as ex:
|
371 |
handle_error(
|
372 |
f'An unexpected error occurred while generating the content: {ex}'
|
373 |
'\n\nPlease try again later, possibly with different inputs.'
|
374 |
' Alternatively, try selecting a different LLM from the dropdown list.'
|
375 |
-
' If you are using Cohere, Gemini, or Together AI models, make sure
|
376 |
-
' provided a correct API key.'
|
377 |
' Read **[how to get free LLM API keys](https://github.com/barun-saha/slide-deck-ai?tab=readme-ov-file#summary-of-the-llms)**.',
|
378 |
True
|
379 |
)
|
|
|
367 |
True
|
368 |
)
|
369 |
return
|
370 |
+
except huggingface_hub.utils._errors.HfHubHTTPError as hfe:
|
371 |
+
_msg = str(hfe).lower()
|
372 |
+
if 'payment required' in _msg:
|
373 |
+
_msg = (
|
374 |
+
'The available inference quota has exhausted.'
|
375 |
+
' Please use your own Hugging Face access token. Paste your token in'
|
376 |
+
' the input field on the sidebar to the left.'
|
377 |
+
'\n\nDon\'t have a token? Get your free'
|
378 |
+
' [HF access token](https://huggingface.co/settings/tokens) now'
|
379 |
+
' and create a magical slide deck!'
|
380 |
+
)
|
381 |
+
|
382 |
+
handle_error(_msg, should_log=True)
|
383 |
+
return
|
384 |
except Exception as ex:
|
385 |
handle_error(
|
386 |
f'An unexpected error occurred while generating the content: {ex}'
|
387 |
'\n\nPlease try again later, possibly with different inputs.'
|
388 |
' Alternatively, try selecting a different LLM from the dropdown list.'
|
389 |
+
' If you are using Azure OpenAI, Cohere, Gemini, or Together AI models, make sure'
|
390 |
+
' that you have provided a correct API key.'
|
391 |
' Read **[how to get free LLM API keys](https://github.com/barun-saha/slide-deck-ai?tab=readme-ov-file#summary-of-the-llms)**.',
|
392 |
True
|
393 |
)
|