Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package HalfFifty.HalfFifty_BE.translation.bean;

import HalfFifty.HalfFifty_BE.translation.domain.DTO.RequestSignLanguageDTO;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.*;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
Expand All @@ -11,7 +13,9 @@
@Component
public class FlaskSignLanguageBean {
private final RestTemplate restTemplate;
private final String aiServerUrl = "http://3.39.24.155/predict"; // Flask 서버 URL

@Value("${ai.server.url}")
private String aiServerUrl; // 환경변수로 관리

public FlaskSignLanguageBean() {
this.restTemplate = new RestTemplate();
Expand All @@ -28,7 +32,12 @@ public Map<String, Object> exec(RequestSignLanguageDTO requestSignLanguageDTO) {
HttpEntity<Map<String, Object>> request = new HttpEntity<>(requestBody, headers);

try {
ResponseEntity<Map> response = restTemplate.postForEntity(aiServerUrl, request, Map.class);
ResponseEntity<Map<String, Object>> response = restTemplate.exchange(
aiServerUrl,
HttpMethod.POST,
request,
new ParameterizedTypeReference<Map<String, Object>>() {}
);

if (response.getStatusCode() == HttpStatus.OK) {
return response.getBody();
Expand Down
5 changes: 4 additions & 1 deletion HalfFifty_BE/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ spring.datasource.username=${DB_USERNAME}
spring.datasource.password=${DB_PASSWORD}

# lambda
aws.lambda.functionName = myLambda
aws.lambda.functionName = myLambda

# AI server
ai.server.url = ${AI_URL}
Loading