Update src/streamlit_app.py
Browse files- src/streamlit_app.py +4 -0
src/streamlit_app.py
CHANGED
|
@@ -66,6 +66,10 @@ def fetch_news():
|
|
| 66 |
|
| 67 |
# bart_model = BartForConditionalGeneration.from_pretrained("facebook/bart-large-cnn")
|
| 68 |
# bart_tokenizer = BartTokenizer.from_pretrained("facebook/bart-large-cnn")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
@st.cache_resource
|
| 71 |
def load_model_and_tokenizer():
|
|
|
|
| 66 |
|
| 67 |
# bart_model = BartForConditionalGeneration.from_pretrained("facebook/bart-large-cnn")
|
| 68 |
# bart_tokenizer = BartTokenizer.from_pretrained("facebook/bart-large-cnn")
|
| 69 |
+
hf_home = os.path.join(os.getcwd(), "hf_cache") # this folder is safe to write to in Spaces
|
| 70 |
+
|
| 71 |
+
os.environ["HF_HOME"] = hf_home
|
| 72 |
+
os.environ["TRANSFORMERS_CACHE"] = hf_home
|
| 73 |
|
| 74 |
@st.cache_resource
|
| 75 |
def load_model_and_tokenizer():
|