|
基于人工智能的通用图片识别平台
开发文档
C++

通用识别(JSON / Base64)

        
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>

// 说明:
// 1) 建议使用 cpp-httplib + nlohmann/json 或你熟悉的 HTTP/JSON 库实现。
// 2) 超时时间建议设置为 60 秒(与平台文档一致)。
// 3) API_URL 支持 HTTP/HTTPS。
const std::string API_URL = "http://api.ttshitu.com";

std::string readBinaryToBase64(const std::string& path) {
    // 这里请接入你已有的 Base64 实现
    // 返回文件 base64 字符串(不带 data:image/... 前缀)
    return "BASE64_IMAGE_DATA";
}

int main() {
    std::string username = "你的账号";
    std::string password = "你的密码";
    std::string typeidValue = "3"; // 数英混合

    std::string imageBase64 = readBinaryToBase64("C:/Users/Administrator/Desktop/file.jpg");

    // JSON 请求体示例:
    // {
    //   "username":"xxx",
    //   "password":"xxx",
    //   "typeid":"3",
    //   "image":"base64..."
    // }
    std::cout << "POST " << API_URL << "/predict" << std::endl;
    std::cout << "typeid=" << typeidValue << std::endl;
    std::cout << "提示:返回 success=true 时,data.result 为识别结果,data.id 可用于报错接口。" << std::endl;
    return 0;
}
        
    

报错脚本

        
// 报错接口:POST http://api.ttshitu.com/reporterror.json
// 请求体:{"id":"识别成功返回的id"}
// 成功后会在批处理时间内返还次数或金额
        
    

余额查询(GET)

        
// GET http://api.ttshitu.com/queryAccountInfo.json?username=你的账号&password=你的密码
// success=true 时 data 包含:balance / consumed / successNum / failNum
        
    
 
您好,有什么需要帮助的吗?