Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,6 +17,20 @@
|
|
| 17 |
from argparse import Namespace
|
| 18 |
args = Namespace()
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
arg_dict = {
|
| 21 |
'run_gradio': True,
|
| 22 |
'demo_public': False,
|
|
|
|
| 17 |
from argparse import Namespace
|
| 18 |
args = Namespace()
|
| 19 |
|
| 20 |
+
import os
|
| 21 |
+
from transformers import AutoTokenizer, AutoModel
|
| 22 |
+
|
| 23 |
+
# Step 1: Get Hugging Face token from the secret
|
| 24 |
+
hf_token = os.environ.get("llmtoken") # HF_TOKEN is the name of the secret in your Space
|
| 25 |
+
|
| 26 |
+
# Step 2: Specify the model
|
| 27 |
+
model_name = "meta-llama/Llama-3.2-3B"
|
| 28 |
+
|
| 29 |
+
# Step 3: Load tokenizer and model using the token
|
| 30 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name, use_auth_token=hf_token)
|
| 31 |
+
model = AutoModel.from_pretrained(model_name, use_auth_token=hf_token)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
arg_dict = {
|
| 35 |
'run_gradio': True,
|
| 36 |
'demo_public': False,
|