Omnibus commited on
Commit
4f1e200
β€’
1 Parent(s): 776d9e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -8
app.py CHANGED
@@ -4,20 +4,15 @@ from transformers import pipeline
4
  import gradio as gr
5
  import os
6
 
7
- models1 = [
8
  "facebook/detr-resnet-50-panoptic",
9
  "CIDAS/clipseg-rd64-refined",
10
  "facebook/maskformer-swin-large-ade",
11
  "nvidia/segformer-b1-finetuned-cityscapes-1024-1024",
12
  ]
13
- current_model = models1[0]
 
14
 
15
- models=[
16
- pipeline("image-segmentation", model="facebook/detr-resnet-50-panoptic"),
17
- pipeline("image-segmentation", model="facebook/maskformer-swin-large-ade"),
18
- pipeline("image-segmentation", model="CIDAS/clipseg-rd64-refined"),
19
- pipeline("image-segmentation", model="nvidia/segformer-b1-finetuned-cityscapes-1024-1024"),
20
- ]
21
 
22
  #model = pipeline("image-segmentation", model="facebook/detr-resnet-50-panoptic")
23
 
@@ -42,6 +37,7 @@ def image_objects(image):
42
  def get_seg(image, model_choice):
43
  image = img_resize(image)
44
  model = models[model_choice]
 
45
  pred = model(image)
46
  pred_object_list = [str(i)+'_'+x['label'] for i, x in enumerate(pred)]
47
  seg_box=[]
 
4
  import gradio as gr
5
  import os
6
 
7
+ models = [
8
  "facebook/detr-resnet-50-panoptic",
9
  "CIDAS/clipseg-rd64-refined",
10
  "facebook/maskformer-swin-large-ade",
11
  "nvidia/segformer-b1-finetuned-cityscapes-1024-1024",
12
  ]
13
+ current_model = models[0]
14
+
15
 
 
 
 
 
 
 
16
 
17
  #model = pipeline("image-segmentation", model="facebook/detr-resnet-50-panoptic")
18
 
 
37
  def get_seg(image, model_choice):
38
  image = img_resize(image)
39
  model = models[model_choice]
40
+ prediction = pipeline("image-segmentation", model=f"{model}")
41
  pred = model(image)
42
  pred_object_list = [str(i)+'_'+x['label'] for i, x in enumerate(pred)]
43
  seg_box=[]