Upload folder using huggingface_hub
Browse files
demo.py
CHANGED
@@ -12,7 +12,7 @@ import os, cv2, time, math
|
|
12 |
print("=> Loading libraries...")
|
13 |
start = time.time()
|
14 |
|
15 |
-
import requests, torch
|
16 |
import gradio as gr
|
17 |
from torchvision import transforms
|
18 |
from datasets import load_dataset
|
@@ -21,6 +21,13 @@ from timm.models import create_model, load_checkpoint
|
|
21 |
from pytorch_grad_cam import GradCAM
|
22 |
from pytorch_grad_cam.utils.image import show_cam_on_image
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
26 |
|
|
|
12 |
print("=> Loading libraries...")
|
13 |
start = time.time()
|
14 |
|
15 |
+
import requests, torch, argparse
|
16 |
import gradio as gr
|
17 |
from torchvision import transforms
|
18 |
from datasets import load_dataset
|
|
|
21 |
from pytorch_grad_cam import GradCAM
|
22 |
from pytorch_grad_cam.utils.image import show_cam_on_image
|
23 |
|
24 |
+
parser = argparse.ArgumentParser()
|
25 |
+
parser.add_argument("--local", action='store_true')
|
26 |
+
args = parser.parse_args()
|
27 |
+
|
28 |
+
if not args.local:
|
29 |
+
from huggingface_hub import login
|
30 |
+
login(token=os.environ["HF_TOKEN"])
|
31 |
|
32 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
33 |
|