import streamlit as st | |
import requests | |
url = 'https://automatethem.pythonanywhere.com/son-height-tabular-regression-scikit-learn/api' | |
number = st.number_input('아버지 키', value=175.0, step=0.1) | |
button = st.button('아들 키 예측') | |
if button: | |
container = st.container() | |
container.caption("예측 결과") | |
payload = {'data': [{'x': str(number)}]} | |
response = requests.post(url, json=payload) | |
outputs = response.json() | |
#print(outputs) #{'data': [{'logit': 175.99442286524624}]} | |
container.text(outputs['data'][0]['logit']) |