Skip to content

Commit

Permalink
Chapter 4 Lab - small fixes on API request body (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
youngroklee-ml authored Feb 3, 2024
1 parent c066563 commit b474a28
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions chapters/sec1/1-4-monitor-log.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ server <- function(input, output) {
{
log4r::info(log, "Prediction Requested")
r <- httr2::request(api_url) |>
httr2::req_body_json(vals()) |>
httr2::req_body_json(list(vals())) |>
httr2::req_perform()
log4r::info(log, "Prediction Returned")

Expand Down Expand Up @@ -395,7 +395,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 All @@ -406,7 +406,7 @@ def server(input, output, session):
@reactive.event(input.predict)
def pred():
logging.info("Request Made")
r = requests.post(api_url, json = vals())
r = requests.post(api_url, json = [vals()])
logging.info("Request Returned")
if r.status_code != 200:
Expand Down

0 comments on commit b474a28

Please sign in to comment.