Spaces:
Runtime error
Runtime error
Merge pull request #45 from barun-saha/maintenance
Browse filesFix #44: show helpful error message when the token count exceeds
Files changed (2)
- app.py+17
- global_config.py+1-1
8 unmodified lines9101112131415202 unmodified lines2182192202212222232242252262272282292302312322332342352362372382398 unmodified linesimport tempfilefrom typing import List, Union
import huggingface_hubimport json5import requestsimport streamlit as st202 unmodified lines logger.error(msg) st.error(msg) return except huggingface_hub.errors.ValidationError as ve: msg = ( f'An error occurred while trying to generate the content: {ve}' '\nPlease try again with a significantly shorter input text.' ) logger.error(msg) st.error(msg) return except Exception as ex: msg = ( f'An unexpected error occurred while generating the content: {ex}' '\nPlease try again later, possibly with different inputs.' ) logger.error(msg) st.error(msg) return
history.add_user_message(prompt) history.add_ai_message(response)20 unmodified lines212223242425262720 unmodified lines LLM_MODEL_TEMPERATURE = 0.2 LLM_MODEL_MIN_OUTPUT_LENGTH = 100 LLM_MODEL_MAX_OUTPUT_LENGTH = 4 * 4096 # tokens LLM_MODEL_MAX_INPUT_LENGTH = 750 # characters LLM_MODEL_MAX_INPUT_LENGTH = 400 # characters
HUGGINGFACEHUB_API_TOKEN = os.environ.get('HUGGINGFACEHUB_API_TOKEN', '')
app.py+17
global_config.py+1-1