Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,17 @@ import torch
|
|
9 |
import argparse
|
10 |
from transformers import AutoModel, AutoTokenizer
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
# For Nvidia GPUs.
|
13 |
# python web_demo_2.5.py --device cuda
|
14 |
|
|
|
9 |
import argparse
|
10 |
from transformers import AutoModel, AutoTokenizer
|
11 |
|
12 |
+
import os
|
13 |
+
from huggingface_hub import login
|
14 |
+
|
15 |
+
# Load the API token from the environment variables
|
16 |
+
api_token = os.getenv('HUGGINGFACE_API_TOKEN')
|
17 |
+
if not api_token:
|
18 |
+
raise ValueError("No Hugging Face API token found. Please set the HUGGING_FACE_API_TOKEN environment variable.")
|
19 |
+
|
20 |
+
# Login to Hugging Face Hub
|
21 |
+
login(token=api_token, add_to_git_credential=True)
|
22 |
+
|
23 |
# For Nvidia GPUs.
|
24 |
# python web_demo_2.5.py --device cuda
|
25 |
|