package com.search.supersearch.cube;


import com.search.supersearch.util.HttpUtils;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

public class OCRDemo {
    private static final String serverUrl = "http://cube2.smartdot.com:18000";
    private static final String projectId = "31";
    private static final String ocrUrl = serverUrl + "/v2/review/projects/" + projectId + "/o/ocr";

    public static String getOcrText(String accessToken) {
        Map<String, String> parameters = new HashMap<>();
        parameters.put("format", "pdf");
        Map<String, File> files = new HashMap<>();
        files.put("file", new File("/Users/wangrui/Downloads/副本_副本_手绘风可爱抖音个人背景图__2023-09-11 17_34_23.jpeg"));
        String r = HttpUtils.post(ocrUrl, parameters, files, accessToken);
        System.out.println(r);
        return r;
    }

    public static void main(String[] args) {
//        getToken();
        getOcrText("PfgE0l2Gc440IltKx5Lta1olasxwIe");
    }
}
