Skip to content

Commit

Permalink
- Updated descrivizio001 hostname in ModelController, using now inter…
Browse files Browse the repository at this point in the history
…nal kubernetes resolution

- Added get_image_description.http for testing image description
  • Loading branch information
nakira974 committed Apr 19, 2023
1 parent 2aa906d commit 60c0c17
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
6 changes: 4 additions & 2 deletions descrivizio001-api/src/controllers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub mod model_processing {
app_photo: web::Json<ApplicationImage>,
client: web::Data<Client>,
) -> Result<HttpResponse, Error> {
let uri = format!("http://{}{}", "descrivizio001:7777", "/model/descrivizio-001");
let uri = format!("http://{}{}", "descrivizio001.default.svc.cluster.local:7777", "/model/descrivizio-001");

let response = match client
.post(&uri)
Expand Down Expand Up @@ -58,7 +58,8 @@ pub mod model_processing {
client: web::Data<Client>,
req: HttpRequest,
) -> Result<HttpResponse, Error> {
let uri = format!("http://{}{}", "descrivizio001:7777", "/model/descrivizio-001");
//34.229.217.159:32000
let uri = format!("http://{}{}", "descrivizio001.default.svc.cluster.local:7777", "/model/descrivizio-001");

// Extract image_url from request headers
let image_url = match req.headers()
Expand All @@ -80,6 +81,7 @@ pub mod model_processing {
let response = client.post(&uri)
.header("Content-Type", "image/*")
.body(image_bytes)
.timeout(Duration::from_secs(300)) // 5 minute timeout
.send()
.await.map_err(|err| actix_web::error::ErrorBadRequest(err.to_string()))?;

Expand Down
6 changes: 6 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ services:
- "8085:8085"
depends_on:
- descrivizio001

descrivizio001-web:
image: nakiradu77/k8s-image-recognition-descrivizio001-web:dev
ports:
- "5248:5248"
- "7001:7001"
6 changes: 6 additions & 0 deletions get_image_description.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# curl --location --request PATCH 'http://localhost:32060/nakira974/model/descrivizio-001/process'
#--header 'Image-Url: https://i1.wp.com/theglobalwizards.com/wp-content/uploads/2020/01/Stuart-Highway-Sign-Alice-Springs-Adelaide.jpg?fit=968%2C645&ssl=1'
PATCH http://descrivizio001.lkh.coffee/nakira974/model/descrivizio-001/process
Image-Url: https://i1.wp.com/theglobalwizards.com/wp-content/uploads/2020/01/Stuart-Highway-Sign-Alice-Springs-Adelaide.jpg?fit=968%2C645&ssl=1

###

0 comments on commit 60c0c17

Please sign in to comment.