Maitreyee22 commited on
Commit
15616a6
·
verified ·
1 Parent(s): bc44efe

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +3 -1
src/streamlit_app.py CHANGED
@@ -14,6 +14,8 @@ import streamlit as st
14
  # It simplifies loading models/tokenizers and running common tasks
15
  from transformers import pipeline
16
 
 
 
17
  # 1. Cache the pipeline so it loads once
18
  @st.cache_resource
19
  def get_generator():
@@ -21,7 +23,7 @@ def get_generator():
21
  # - "text2text-generation" tells the pipeline we want a seq2seq model (T5 family)
22
  # - model="google/flan-t5-small" specifies which pretrained model to load
23
  # The pipeline object wraps both tokenizer and model for you.
24
- return pipeline("text2text-generation", model="google/flan-t5-small", use_auth_token=True)
25
 
26
  generator = get_generator()
27
 
 
14
  # It simplifies loading models/tokenizers and running common tasks
15
  from transformers import pipeline
16
 
17
+ hf_token = st.secrets["HF_HUB_TOKEN"]
18
+
19
  # 1. Cache the pipeline so it loads once
20
  @st.cache_resource
21
  def get_generator():
 
23
  # - "text2text-generation" tells the pipeline we want a seq2seq model (T5 family)
24
  # - model="google/flan-t5-small" specifies which pretrained model to load
25
  # The pipeline object wraps both tokenizer and model for you.
26
+ return pipeline("text2text-generation", model="google/flan-t5-small", use_auth_token=hf_token)
27
 
28
  generator = get_generator()
29