Spaces:
Build error
Build error
ryanpdwyer
commited on
Commit
·
b195166
1
Parent(s):
a689f83
Updated to use token
Browse files
app.py
CHANGED
@@ -2,6 +2,13 @@ import streamlit as st
|
|
2 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
3 |
import torch
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
# Load models and tokenizers
|
6 |
@st.cache_resource
|
7 |
def load_model_and_tokenizer(model_name):
|
|
|
2 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
3 |
import torch
|
4 |
|
5 |
+
# Retrieve the Hugging Face token from environment variables
|
6 |
+
hf_token = os.environ.get("HF_TOKEN")
|
7 |
+
|
8 |
+
if not hf_token:
|
9 |
+
st.error("Hugging Face token not found. Please add your HF_TOKEN to the Space secrets.")
|
10 |
+
st.stop()
|
11 |
+
|
12 |
# Load models and tokenizers
|
13 |
@st.cache_resource
|
14 |
def load_model_and_tokenizer(model_name):
|