Spaces:
Running
on
Zero
Running
on
Zero
hugohabicht01
commited on
Commit
·
af83bc0
1
Parent(s):
973cd99
further fix
Browse files- app.py +3 -0
- blurnonymize.py +2 -3
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
import spaces
|
3 |
import torch
|
4 |
from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
|
@@ -12,6 +13,8 @@ import utils
|
|
12 |
from utils import BoundingBox
|
13 |
import blurnonymize
|
14 |
|
|
|
|
|
15 |
MODEL_NAME = "cborg/qwen2.5VL-3b-privacydetector"
|
16 |
MAX_NEW_TOKENS = 2048
|
17 |
TEMPERATURE = 1.0
|
|
|
1 |
import gradio as gr
|
2 |
+
import os
|
3 |
import spaces
|
4 |
import torch
|
5 |
from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
|
|
|
13 |
from utils import BoundingBox
|
14 |
import blurnonymize
|
15 |
|
16 |
+
os.environ['HF_HOME'] = '/data/.huggingface'
|
17 |
+
|
18 |
MODEL_NAME = "cborg/qwen2.5VL-3b-privacydetector"
|
19 |
MAX_NEW_TOKENS = 2048
|
20 |
TEMPERATURE = 1.0
|
blurnonymize.py
CHANGED
@@ -158,12 +158,11 @@ class ImageBlurnonymizer:
|
|
158 |
|
159 |
# self.device = "cuda" if torch.cuda.is_available() else "cpu"
|
160 |
# self.device = "cuda"
|
161 |
-
self.device =
|
162 |
# Set the device for PyTorch
|
163 |
-
torch.cuda.set_device(self.device)
|
164 |
self.predictor = SAM2ImagePredictor.from_pretrained(
|
165 |
"facebook/sam2.1-hiera-small",
|
166 |
-
device=
|
167 |
)
|
168 |
|
169 |
@staticmethod
|
|
|
158 |
|
159 |
# self.device = "cuda" if torch.cuda.is_available() else "cpu"
|
160 |
# self.device = "cuda"
|
161 |
+
self.device = "cuda"
|
162 |
# Set the device for PyTorch
|
|
|
163 |
self.predictor = SAM2ImagePredictor.from_pretrained(
|
164 |
"facebook/sam2.1-hiera-small",
|
165 |
+
device=self.device,
|
166 |
)
|
167 |
|
168 |
@staticmethod
|