Spaces:
Sleeping
Sleeping
use hf_hub_download
Browse files
app.py
CHANGED
@@ -15,14 +15,17 @@ from transforms import (
|
|
15 |
)
|
16 |
|
17 |
import gradio as gr
|
|
|
18 |
|
19 |
# Device on which to run the model
|
20 |
# Set to cuda to load on GPU
|
21 |
device = "cpu"
|
22 |
-
os.system("wget https://cdn-lfs.huggingface.co/Andy1621/uniformer/d5fd7b0c49ee6a5422ef5d0c884d962c742003bfbd900747485eb99fa269d0db")
|
|
|
23 |
# Pick a pretrained model
|
24 |
model = uniformer_small()
|
25 |
-
state_dict = torch.load('d5fd7b0c49ee6a5422ef5d0c884d962c742003bfbd900747485eb99fa269d0db', map_location='cpu')
|
|
|
26 |
model.load_state_dict(state_dict)
|
27 |
|
28 |
# Set to eval mode and move to desired device
|
|
|
15 |
)
|
16 |
|
17 |
import gradio as gr
|
18 |
+
from huggingface_hub import hf_hub_download
|
19 |
|
20 |
# Device on which to run the model
|
21 |
# Set to cuda to load on GPU
|
22 |
device = "cpu"
|
23 |
+
# os.system("wget https://cdn-lfs.huggingface.co/Andy1621/uniformer/d5fd7b0c49ee6a5422ef5d0c884d962c742003bfbd900747485eb99fa269d0db")
|
24 |
+
model_path = hf_hub_download(repo_id="Andy1621/uniformer", filename="uniformer_small_k400_16x8.pth")
|
25 |
# Pick a pretrained model
|
26 |
model = uniformer_small()
|
27 |
+
# state_dict = torch.load('d5fd7b0c49ee6a5422ef5d0c884d962c742003bfbd900747485eb99fa269d0db', map_location='cpu')
|
28 |
+
state_dict = torch.load(model_path, map_location='cpu')
|
29 |
model.load_state_dict(state_dict)
|
30 |
|
31 |
# Set to eval mode and move to desired device
|