Spaces:
Running
on
A10G
Running
on
A10G
File size: 1,094 Bytes
4112985 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
import os
import numpy
from PIL import Image
import requests
import urllib.request
from http import HTTPStatus
from datetime import datetime
import json
from .log import logger
import time
import gradio as gr
from .util import download_images
API_KEY = os.getenv("API_KEY_VIRTUALMODEL")
def call_person_detect(input_image_url):
headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": f"Bearer {API_KEY}",
"X-DashScope-DataInspection": "enable",
}
data = {
"model": "body-detection",
"input":{
"image_url": input_image_url,
},
"parameters": {
"score_threshold": 0.6,
}
}
url_create_task = 'https://dashscope.aliyuncs.com/api/v1/services/vision/bodydetection/detect'
res_ = requests.post(url_create_task, data=json.dumps(data), headers=headers)
res = json.loads(res_.content.decode())
request_id = res['request_id']
results = res['output']['results']
return results |