Spaces:
Running
Running
Alex
commited on
Commit
·
ca8948a
1
Parent(s):
03061bd
removed hf token
Browse files
app.py
CHANGED
@@ -17,9 +17,9 @@ class ImageURL(BaseModel):
|
|
17 |
class ModelManager:
|
18 |
def __init__(self):
|
19 |
self.logger = logging.getLogger(__name__)
|
20 |
-
self.token = os.getenv("HF_TOKEN")
|
21 |
-
if not self.token:
|
22 |
-
|
23 |
self._initialize_models()
|
24 |
|
25 |
def _initialize_models(self):
|
@@ -31,24 +31,24 @@ class ModelManager:
|
|
31 |
fashion_path = hf_hub_download(
|
32 |
repo_id="alexgenovese/segformer-onnx",
|
33 |
filename="segformer-b3-fashion.onnx",
|
34 |
-
token=self.token
|
35 |
)
|
36 |
self.fashion_model = ort.InferenceSession(fashion_path)
|
37 |
self.fashion_processor = SegformerImageProcessor.from_pretrained(
|
38 |
"sayeed99/segformer-b3-fashion",
|
39 |
-
token=self.token
|
40 |
)
|
41 |
|
42 |
# Download and load clothes model
|
43 |
clothes_path = hf_hub_download(
|
44 |
repo_id="alexgenovese/segformer-onnx",
|
45 |
filename="segformer_b2_clothes.onnx",
|
46 |
-
token=self.token
|
47 |
)
|
48 |
self.clothes_model = ort.InferenceSession(clothes_path)
|
49 |
self.clothes_processor = SegformerImageProcessor.from_pretrained(
|
50 |
"mattmdjaga/segformer_b2_clothes",
|
51 |
-
token=self.token
|
52 |
)
|
53 |
|
54 |
self.logger.info("All models loaded successfully.")
|
|
|
17 |
class ModelManager:
|
18 |
def __init__(self):
|
19 |
self.logger = logging.getLogger(__name__)
|
20 |
+
# self.token = os.getenv("HF_TOKEN")
|
21 |
+
# if not self.token:
|
22 |
+
# raise ValueError("HF_TOKEN environment variable is required")
|
23 |
self._initialize_models()
|
24 |
|
25 |
def _initialize_models(self):
|
|
|
31 |
fashion_path = hf_hub_download(
|
32 |
repo_id="alexgenovese/segformer-onnx",
|
33 |
filename="segformer-b3-fashion.onnx",
|
34 |
+
# token=self.token
|
35 |
)
|
36 |
self.fashion_model = ort.InferenceSession(fashion_path)
|
37 |
self.fashion_processor = SegformerImageProcessor.from_pretrained(
|
38 |
"sayeed99/segformer-b3-fashion",
|
39 |
+
# token=self.token
|
40 |
)
|
41 |
|
42 |
# Download and load clothes model
|
43 |
clothes_path = hf_hub_download(
|
44 |
repo_id="alexgenovese/segformer-onnx",
|
45 |
filename="segformer_b2_clothes.onnx",
|
46 |
+
# token=self.token
|
47 |
)
|
48 |
self.clothes_model = ort.InferenceSession(clothes_path)
|
49 |
self.clothes_processor = SegformerImageProcessor.from_pretrained(
|
50 |
"mattmdjaga/segformer_b2_clothes",
|
51 |
+
# token=self.token
|
52 |
)
|
53 |
|
54 |
self.logger.info("All models loaded successfully.")
|