|
import streamlit as st |
|
import requests |
|
|
|
st.title("Predictive Model App") |
|
|
|
|
|
high = st.number_input("High", format="%f") |
|
low = st.number_input("Low", format="%f") |
|
open_val = st.number_input("Open", format="%f") |
|
volume = st.number_input("Volume", format="%f") |
|
|
|
url = "https://nareshstp.pythonanywhere.com/predict" |
|
|
|
|
|
if st.button("Predict"): |
|
|
|
params = { |
|
"high": str(high), |
|
"low": str(low), |
|
"open": str(open_val), |
|
"volume": str(volume) |
|
} |
|
|
|
|
|
try: |
|
response = requests.post(url, data=params) |
|
|
|
|
|
if response.status_code == 200: |
|
result_data = response.json() |
|
|
|
|
|
st.markdown(f"## Result ") |
|
st.markdown(f"<div style='background-color: #f5f5f5; padding: 20px; border-radius: 5px;'><span style='font-size: 24px;'>{result_data.get('res')}</span></div>", unsafe_allow_html=True) |
|
else: |
|
st.error(f"API Error: {response.status_code}. {response.text}") |
|
|
|
except Exception as e: |
|
st.error(f"Error: {e}") |
|
|