Upload files to "/"
This commit is contained in:
53
fnc_26ai_traffic_vision.sql
Normal file
53
fnc_26ai_traffic_vision.sql
Normal file
@@ -0,0 +1,53 @@
|
||||
create or replace function fnc_26ai_traffic_vision( p_base64_image in clob, p_feature_type in varchar2 , p_comp_id in varchar2)
|
||||
return clob
|
||||
--
|
||||
-- Visio: https://docs.oracle.com/pt-br/solutions/ai-vision-extract-data/index.html#GUID-A4FD65D0-BF62-472B-B4C7-0ADF5425A566
|
||||
--
|
||||
as
|
||||
/*
|
||||
p_feature_type: https://docs.oracle.com/en-us/iaas/api/#/en/vision/20220125/datatypes/ImageFeature
|
||||
|
||||
IMAGE_CLASSIFICATION: Label the image.
|
||||
OBJECT_DETECTION: Identify objects in the image with bounding boxes.
|
||||
TEXT_DETECTION: Recognize text at the word and line level.
|
||||
FACE_DETECTION: Identify faces in the image with bounding boxes and face landmarks.
|
||||
|
||||
*/
|
||||
v_endpoint varchar2(500) := 'https://vision.aiservice.us-chicago-1.oci.oraclecloud.com/20220125/actions/analyzeImage';
|
||||
request_json CLOB;
|
||||
l_response_body clob;
|
||||
|
||||
begin
|
||||
|
||||
request_json := to_clob('{
|
||||
"compartmentId": "' || p_comp_id || '",
|
||||
"image": {
|
||||
"source":"INLINE",
|
||||
"data":"' || p_base64_image || '"
|
||||
},
|
||||
"features":[
|
||||
{
|
||||
"featureType":"' || p_feature_type || '",
|
||||
"maxResults": 5
|
||||
}
|
||||
]
|
||||
}' );
|
||||
|
||||
-- Definir os cabeçalhos da requisição
|
||||
APEX_WEB_SERVICE.G_REQUEST_HEADERS(1).NAME := 'Content-Type';
|
||||
APEX_WEB_SERVICE.G_REQUEST_HEADERS(1).VALUE := 'application/json';
|
||||
APEX_WEB_SERVICE.G_REQUEST_HEADERS(2).NAME := 'Accept';
|
||||
APEX_WEB_SERVICE.G_REQUEST_HEADERS(2).VALUE := 'application/json';
|
||||
|
||||
-- Faça a chamada POST usando APEX_WEB_SERVICE e a credencial OCI
|
||||
l_response_body := APEX_WEB_SERVICE.make_rest_request(
|
||||
p_url => v_endpoint,
|
||||
p_http_method => 'POST',
|
||||
p_body => request_json,
|
||||
p_credential_static_id => 'apex_cred'
|
||||
);
|
||||
|
||||
return l_response_body;
|
||||
|
||||
end;
|
||||
/
|
||||
Reference in New Issue
Block a user