Spaces:
Runtime error
Runtime error
prabinpanta0
commited on
Commit
•
6a01360
1
Parent(s):
bd35118
Update app.py
Browse files
app.py
CHANGED
@@ -9,13 +9,13 @@ HF_TOKEN = os.getenv('HF')
|
|
9 |
if not HF_TOKEN:
|
10 |
raise ValueError("The HF environment variable is not set. Please set it to your Hugging Face token.")
|
11 |
|
12 |
-
# Authenticate with Hugging Face
|
13 |
login(HF_TOKEN, add_to_git_credential=True)
|
14 |
|
15 |
# Load the model and tokenizer using the Hugging Face token
|
16 |
model_name = "google/gemma-7b-it"
|
17 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name,
|
18 |
-
model = AutoModelForSeq2SeqLM.from_pretrained(model_name,
|
19 |
|
20 |
def generate(text):
|
21 |
try:
|
|
|
9 |
if not HF_TOKEN:
|
10 |
raise ValueError("The HF environment variable is not set. Please set it to your Hugging Face token.")
|
11 |
|
12 |
+
# Authenticate with Hugging Face and save the token to the Git credentials helper
|
13 |
login(HF_TOKEN, add_to_git_credential=True)
|
14 |
|
15 |
# Load the model and tokenizer using the Hugging Face token
|
16 |
model_name = "google/gemma-7b-it"
|
17 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name, token=HF_TOKEN)
|
18 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_name, token=HF_TOKEN)
|
19 |
|
20 |
def generate(text):
|
21 |
try:
|