Commit
·
f4e22ef
1
Parent(s):
5987ee5
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,9 @@
|
|
1 |
import streamlit as st
|
2 |
-
import
|
3 |
-
from lib_pipeline import TabularRegressionPipeLine
|
4 |
|
|
|
|
|
|
|
5 |
@st.cache(allow_output_mutation=True)
|
6 |
def get_pipeline():
|
7 |
model_path = 'automatethem-com/son-height-tabular-regression-scikit-learn'
|
@@ -9,6 +11,7 @@ def get_pipeline():
|
|
9 |
return p
|
10 |
|
11 |
p = get_pipeline()
|
|
|
12 |
|
13 |
number = st.number_input('아버지 키', value=175.0, step=0.1)
|
14 |
button = st.button('아들 키 예측')
|
@@ -16,10 +19,8 @@ button = st.button('아들 키 예측')
|
|
16 |
if button:
|
17 |
container = st.container()
|
18 |
container.caption("예측 결과")
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
logit = result['logit']
|
25 |
-
container.text(logit)
|
|
|
1 |
import streamlit as st
|
2 |
+
import requests
|
|
|
3 |
|
4 |
+
url = 'https://automatethem.pythonanywhere.com/son-height-tabular-regression-scikit-learn/api'
|
5 |
+
|
6 |
+
'''
|
7 |
@st.cache(allow_output_mutation=True)
|
8 |
def get_pipeline():
|
9 |
model_path = 'automatethem-com/son-height-tabular-regression-scikit-learn'
|
|
|
11 |
return p
|
12 |
|
13 |
p = get_pipeline()
|
14 |
+
'''
|
15 |
|
16 |
number = st.number_input('아버지 키', value=175.0, step=0.1)
|
17 |
button = st.button('아들 키 예측')
|
|
|
19 |
if button:
|
20 |
container = st.container()
|
21 |
container.caption("예측 결과")
|
22 |
+
payload = {'data': [{'x': str(number)}]}
|
23 |
+
response = requests.post(url, json=payload)
|
24 |
+
outputs = response.json()
|
25 |
+
#print(outputs) #{'data': [{'logit': 175.99442286524624}]}
|
26 |
+
container.text(outputs['data'][0]['logit'])
|
|
|
|