Spaces:
Sleeping
Sleeping
File size: 536 Bytes
a5fe81c 1fefb78 a5fe81c 1fefb78 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
from transformers import DPTFeatureExtractor, DPTForSemanticSegmentation
from PIL import Image
import requests
import streamlit as st
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
feature_extractor = DPTFeatureExtractor.from_pretrained("Intel/dpt-large-ade")
model = DPTForSemanticSegmentation.from_pretrained("Intel/dpt-large-ade")
inputs = feature_extractor(images=image, return_tensors="pt")
outputs = model(**inputs)
logits = outputs.logits
st.json(logits) |