adding auth
Browse files
app.py
CHANGED
@@ -11,35 +11,35 @@ import time
|
|
11 |
import torch
|
12 |
import spaces
|
13 |
import os
|
14 |
-
from huggingface_hub import HfApi, login
|
15 |
-
|
16 |
-
def setup_hf_auth():
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
|
27 |
|
28 |
-
|
29 |
-
|
30 |
|
31 |
-
|
32 |
-
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
|
38 |
-
|
39 |
|
40 |
-
except Exception as e:
|
41 |
-
|
42 |
-
|
43 |
|
44 |
from video_highlight_detector import (
|
45 |
load_model,
|
@@ -208,9 +208,9 @@ if __name__ == "__main__":
|
|
208 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
209 |
zero = torch.Tensor([0]).to(device)
|
210 |
|
211 |
-
hf_api = setup_hf_auth()
|
212 |
-
if not hf_api:
|
213 |
-
|
214 |
|
215 |
app = create_ui("video_spec.json")
|
216 |
app.launch()
|
|
|
11 |
import torch
|
12 |
import spaces
|
13 |
import os
|
14 |
+
# from huggingface_hub import HfApi, login
|
15 |
+
|
16 |
+
# def setup_hf_auth():
|
17 |
+
# """
|
18 |
+
# Set up Hugging Face authentication using a token stored as a secret.
|
19 |
+
# Returns authenticated HfApi instance if successful.
|
20 |
+
# """
|
21 |
+
# try:
|
22 |
+
# # First try to get token from environment variable
|
23 |
+
# hf_token = os.getenv('HF_TOKEN')
|
24 |
|
25 |
+
# if not hf_token:
|
26 |
+
# raise ValueError("HF_TOKEN not found in environment variables or .env file")
|
27 |
|
28 |
+
# # Login to Hugging Face
|
29 |
+
# login(token=hf_token)
|
30 |
|
31 |
+
# # Initialize API client
|
32 |
+
# api = HfApi()
|
33 |
|
34 |
+
# # Verify authentication by trying to get user info
|
35 |
+
# user_info = api.whoami()
|
36 |
+
# print(f"Successfully authenticated as: {user_info.name}")
|
37 |
|
38 |
+
# return api
|
39 |
|
40 |
+
# except Exception as e:
|
41 |
+
# print(f"Authentication failed: {str(e)}")
|
42 |
+
# return None
|
43 |
|
44 |
from video_highlight_detector import (
|
45 |
load_model,
|
|
|
208 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
209 |
zero = torch.Tensor([0]).to(device)
|
210 |
|
211 |
+
# hf_api = setup_hf_auth()
|
212 |
+
# if not hf_api:
|
213 |
+
# raise RuntimeError("Failed to authenticate with Hugging Face")
|
214 |
|
215 |
app = create_ui("video_spec.json")
|
216 |
app.launch()
|