Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -20,6 +20,8 @@ import torch.nn as nn
|
|
20 |
from torchvision import transforms,models #, datasets
|
21 |
SEED = 1234
|
22 |
|
|
|
|
|
23 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
24 |
num_classes = 15
|
25 |
criterion = nn.CrossEntropyLoss()
|
@@ -33,14 +35,6 @@ model.fc = nn.Linear(num_ftrs, num_classes)
|
|
33 |
model = model.to(device)
|
34 |
|
35 |
|
36 |
-
|
37 |
-
# set Detectron2
|
38 |
-
cfg = get_cfg()
|
39 |
-
cfg.merge_from_file(model_zoo.get_config_file("COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml"))
|
40 |
-
cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5
|
41 |
-
cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url("COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml")
|
42 |
-
predictor = DefaultPredictor(cfg)
|
43 |
-
|
44 |
# build Gradio interface
|
45 |
def segment_image(image):
|
46 |
outputs = predictor(image)
|
|
|
20 |
from torchvision import transforms,models #, datasets
|
21 |
SEED = 1234
|
22 |
|
23 |
+
print("hello world")
|
24 |
+
|
25 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
26 |
num_classes = 15
|
27 |
criterion = nn.CrossEntropyLoss()
|
|
|
35 |
model = model.to(device)
|
36 |
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
# build Gradio interface
|
39 |
def segment_image(image):
|
40 |
outputs = predictor(image)
|