Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,10 @@ import os
|
|
| 2 |
import streamlit as st
|
| 3 |
from transformers import pipeline
|
| 4 |
import warnings
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
|
| 7 |
|
|
@@ -37,7 +41,7 @@ def load_model(model_name):
|
|
| 37 |
with warnings.catch_warnings():
|
| 38 |
warnings.simplefilter("ignore")
|
| 39 |
access_token = os.getenv("HF_ACCESS_TOKEN") # Use an environment variable for the access token
|
| 40 |
-
return pipeline("text-generation", model=model_name,
|
| 41 |
|
| 42 |
|
| 43 |
# Button to run the model
|
|
|
|
| 2 |
import streamlit as st
|
| 3 |
from transformers import pipeline
|
| 4 |
import warnings
|
| 5 |
+
from huggingface_hub import login
|
| 6 |
+
|
| 7 |
+
login(token =
|
| 8 |
+
<huggingfaec-token>)
|
| 9 |
|
| 10 |
|
| 11 |
|
|
|
|
| 41 |
with warnings.catch_warnings():
|
| 42 |
warnings.simplefilter("ignore")
|
| 43 |
access_token = os.getenv("HF_ACCESS_TOKEN") # Use an environment variable for the access token
|
| 44 |
+
return pipeline("text-generation", model=model_name, token=access_token) # Use TensorFlow framework
|
| 45 |
|
| 46 |
|
| 47 |
# Button to run the model
|