Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,11 +2,15 @@ import gradio as gr
|
|
2 |
import numpy as np
|
3 |
import torch
|
4 |
from transformers import Mask2FormerImageProcessor, Mask2FormerForUniversalSegmentation
|
|
|
|
|
|
|
|
|
5 |
|
6 |
# Load the model from Hugging Face
|
7 |
model_name = "gdurkin/cdl_mask2former_hi_res_v3"
|
8 |
-
processor = Mask2FormerImageProcessor.from_pretrained(model_name)
|
9 |
-
model = Mask2FormerForUniversalSegmentation.from_pretrained(model_name)
|
10 |
device = torch.device('cpu')
|
11 |
|
12 |
# Define the inference function
|
|
|
2 |
import numpy as np
|
3 |
import torch
|
4 |
from transformers import Mask2FormerImageProcessor, Mask2FormerForUniversalSegmentation
|
5 |
+
import os
|
6 |
+
access_token = os.getenv('HF_TOKEN')
|
7 |
+
from huggingface_hub import login
|
8 |
+
login(token = access_token)
|
9 |
|
10 |
# Load the model from Hugging Face
|
11 |
model_name = "gdurkin/cdl_mask2former_hi_res_v3"
|
12 |
+
processor = Mask2FormerImageProcessor.from_pretrained(model_name,token = access_token)
|
13 |
+
model = Mask2FormerForUniversalSegmentation.from_pretrained(model_name,token = access_token)
|
14 |
device = torch.device('cpu')
|
15 |
|
16 |
# Define the inference function
|