llm-arch / src /common.py
alfraser's picture
Refactored HF token ID access to a common function
5117e0a
raw
history blame
433 Bytes
import os
import streamlit as st
data_dir = os.path.join(os.path.dirname(__file__), '..', 'data')
config_dir = os.path.join(os.path.dirname(__file__), '..', 'config')
def hf_api_token() -> str:
#TODO: Need to consider how to make this more generic to look for a token elsewhere
token = st.secrets['hf_token']
if token is None:
raise ValueError('No HF access token found in streamlit secrets')
return token