Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

接口 #1

Open
qq846511277 opened this issue Nov 28, 2024 · 0 comments
Open

接口 #1

qq846511277 opened this issue Nov 28, 2024 · 0 comments

Comments

@qq846511277
Copy link

def identify(self,mo, code, model):

    url = f"http://47.122.0.155:11128/predict"
    payload = {
        'image': code  # 这里 code 是 Base64 编码的图片字符串
    }
    headers = {
        'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
        'Content-Type': 'application/json',  # 更改为 application/json
        'source': '1',
        'model': model
    }
    response = requests.post(url, headers=headers, data=json.dumps(payload))
    pattern = re.compile(r'\[\[(.*?)\]\]')
    matches = pattern.findall(response.text)
    matches = matches[0].replace(' ', '').replace('],[', '%7C').replace(',', '%2C')

    return matches
    
   我直接两个标签一步直接出结果 比你那个稍微快些吧
   {'inference_time': 0.03037858009338379, 'midpoints': [[32, 37], [241, 45]]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant