Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -47,11 +47,18 @@ st.markdown('<div class="blurred-background"></div>', unsafe_allow_html=True)
|
|
| 47 |
|
| 48 |
#""""""""""""""""""""""""" Application Code Starts here """""""""""""""""""""""""""""""""""""""""""""
|
| 49 |
|
| 50 |
-
#
|
|
|
|
|
|
|
|
|
|
| 51 |
@st.cache_resource
|
| 52 |
def load_text_generation_model():
|
| 53 |
try:
|
| 54 |
-
return pipeline(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
except Exception as e:
|
| 56 |
st.error(f"Error loading model: {e}")
|
| 57 |
return None
|
|
|
|
| 47 |
|
| 48 |
#""""""""""""""""""""""""" Application Code Starts here """""""""""""""""""""""""""""""""""""""""""""
|
| 49 |
|
| 50 |
+
# Hugging Face access token
|
| 51 |
+
HF_TOKEN = "HF_TOKEN" # Replace with your actual token or use environment variables
|
| 52 |
+
|
| 53 |
+
# Load the text generation model pipeline with authentication
|
| 54 |
@st.cache_resource
|
| 55 |
def load_text_generation_model():
|
| 56 |
try:
|
| 57 |
+
return pipeline(
|
| 58 |
+
"text-generation",
|
| 59 |
+
model="google/gemma-2-9b-it",
|
| 60 |
+
use_auth_token=HF_TOKEN
|
| 61 |
+
)
|
| 62 |
except Exception as e:
|
| 63 |
st.error(f"Error loading model: {e}")
|
| 64 |
return None
|