File size: 556 Bytes
d6abba6
f4e22ef
d6abba6
f4e22ef
 
d6abba6
2f2d80f
d6abba6
 
 
 
f4e22ef
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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'])