From d54404fef5e3801b813690e9040b0f6ecc271b70 Mon Sep 17 00:00:00 2001 From: jhicks2306 <45722942+jhicks2306@users.noreply.github.com> Date: Sat, 3 Feb 2024 16:14:13 +0000 Subject: [PATCH] Small fixes to python requests in Chapter 3 (#220) --- chapters/sec1/1-3-data-access.qmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chapters/sec1/1-3-data-access.qmd b/chapters/sec1/1-3-data-access.qmd index ed0e1925..1829ba40 100644 --- a/chapters/sec1/1-3-data-access.qmd +++ b/chapters/sec1/1-3-data-access.qmd @@ -580,7 +580,7 @@ req_data = { "species_Gentoo": False, "sex_male": False } -req = requests.post('http://127.0.0.1:8080/predict', json = req_data) +req = requests.post('http://127.0.0.1:8080/predict', json = [req_data]) res = req.json().get('predict')[0] ``` @@ -666,7 +666,7 @@ def server(input, output, session): @reactive.Calc @reactive.event(input.predict) def pred(): - r = requests.post(api_url, json = vals()) + r = requests.post(api_url, json = [vals()]) return r.json().get('predict')[0] @output