Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -20,8 +20,8 @@ vision_model = MllamaForConditionalGeneration.from_pretrained(
|
|
20 |
)
|
21 |
processor = AutoProcessor.from_pretrained(llama_vision_model_id, token=hf_token)
|
22 |
|
23 |
-
# Set up segmentation model using
|
24 |
-
segment_model_id = "
|
25 |
segment_pipe = pipeline(
|
26 |
"image-segmentation",
|
27 |
model=segment_model_id,
|
@@ -45,7 +45,7 @@ def process_image(image):
|
|
45 |
output = vision_model.generate(**inputs, max_new_tokens=50)
|
46 |
caption = processor.decode(output[0], skip_special_tokens=True)
|
47 |
|
48 |
-
# Step 2: Segment important parts of the image using
|
49 |
segmented_result = segment_pipe(image=image)
|
50 |
segments = segmented_result
|
51 |
|
|
|
20 |
)
|
21 |
processor = AutoProcessor.from_pretrained(llama_vision_model_id, token=hf_token)
|
22 |
|
23 |
+
# Set up segmentation model using MaskFormer Swin Large from Hugging Face Hub
|
24 |
+
segment_model_id = "facebook/maskformer-swin-large"
|
25 |
segment_pipe = pipeline(
|
26 |
"image-segmentation",
|
27 |
model=segment_model_id,
|
|
|
45 |
output = vision_model.generate(**inputs, max_new_tokens=50)
|
46 |
caption = processor.decode(output[0], skip_special_tokens=True)
|
47 |
|
48 |
+
# Step 2: Segment important parts of the image using MaskFormer Swin Large
|
49 |
segmented_result = segment_pipe(image=image)
|
50 |
segments = segmented_result
|
51 |
|