@@ -124,29 +124,29 @@ public static ImageStore[] make3Drequest() {
124124 }
125125
126126
127- public static String convertImage (String imageLocation ) {
127+ public static String convertImage (String imageLocation , String fileName ) {
128128 String apiUrl = "https://api.meshy.ai/v1/image-to-3d" ;
129129 RestTemplate restTemplate = new RestTemplate ();
130130 HttpHeaders headers = new HttpHeaders ();
131131 headers .setContentType (MediaType .APPLICATION_JSON );
132132 headers .set ("Authorization" , "Bearer " + AIApplication .THREEDEY );
133133 String requestJson =
134134// "{\"image_url\": \"https://upload.wikimedia.org/wikipedia/commons/e/e1/Face_%E2%80%93_Alexander.jpg\", " +
135- "{\" image_url\" : \" " +imageLocation +"\" , " +
135+ "{\" image_url\" : \" " +imageLocation + fileName +"\" , " +
136136 "\" enable_pbr\" : true, \" surface_mode\" : \" hard\" }" ;
137137 HttpEntity <String > entity = new HttpEntity <>(requestJson , headers );
138138 ResponseEntity <String > response = restTemplate .postForEntity (apiUrl , entity , String .class );
139139 ObjectMapper mapper = new ObjectMapper ();
140140 try {
141141 JsonNode root = mapper .readTree (response .getBody ());
142142 String theResultString = root .path ("result" ).asText ();
143- return pollApiUntilSuccess (theResultString );
143+ return pollApiUntilSuccess (fileName , theResultString );
144144 } catch (IOException e ) {
145145 e .printStackTrace ();
146146 return "Error parsing JSON" ;
147147 }
148148 }
149- public static String pollApiUntilSuccess (String theResultString ) {
149+ public static String pollApiUntilSuccess (String fileName , String theResultString ) {
150150 RestTemplate restTemplate = new RestTemplate ();
151151 HttpHeaders headers = new HttpHeaders ();
152152 headers .set ("Authorization" , "Bearer " + AIApplication .THREEDEY );
@@ -162,7 +162,7 @@ public static String pollApiUntilSuccess(String theResultString) {
162162 HttpMethod .GET , entity , String .class );
163163 JsonNode rootNode = mapper .readTree (response .getBody ());
164164 String status = rootNode .path ("status" ).asText ();
165- System .out .println ("ORDSCalls.pollApiUntilSuccess status:" + status );
165+ System .out .println (fileName + " status:" + status );
166166 if ("SUCCEEDED" .equals (status )) {
167167// String modelUrl = rootNode.path("model_url").asText();
168168// String modelGlbUrl = rootNode.path("model_urls").path("glb").asText();
0 commit comments