Skip to content

Commit

Permalink
A couple of fixes to lab exercise in Chapter 3 (#225)
Browse files Browse the repository at this point in the history
* correct parameter name for API: `sex_Male` -> `sex_male`

* pass request body json as a list of a list
  • Loading branch information
youngroklee-ml authored Feb 3, 2024
1 parent 84a3345 commit 1195786
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions chapters/sec1/1-3-data-access.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ def server(input, output, session):
def vals():
d = {
"bill_length_mm" : input.bill_length(),
"sex_Male" : input.sex() == "Male",
"sex_male" : input.sex() == "Male",
"species_Gentoo" : input.species() == "Gentoo",
"species_Chinstrap" : input.species() == "Chinstrap"
Expand Down Expand Up @@ -745,7 +745,7 @@ server <- function(input, output) {
pred <- eventReactive(
input$predict,
httr2::request(api_url) |>
httr2::req_body_json(vals()) |>
httr2::req_body_json(list(vals())) |>
httr2::req_perform() |>
httr2::resp_body_json(),
ignoreInit = TRUE
Expand Down

0 comments on commit 1195786

Please sign in to comment.