ml-deployment-platform / src /streamlit_app.py
harshitrk07's picture
Update src/streamlit_app.py
f98512a verified
Raw History Blame Contribute Delete
1.37 kB
import streamlit as st
import requests
API_URL = "https://ml-deployment-platform.onrender.com/predict"
st.set_page_config(page_title="ML Deployment Platform", page_icon="๐ŸŒธ")
st.title("๐ŸŒธ Iris Flower Predictor")
st.markdown("### Powered by FastAPI + Docker + Render")
st.markdown("---")
st.subheader("Enter Flower Measurements:")
col1, col2 = st.columns(2)
with col1:
sepal_length = st.slider("Sepal Length (cm)", 4.0, 8.0, 5.1)
sepal_width = st.slider("Sepal Width (cm)", 2.0, 5.0, 3.5)
with col2:
petal_length = st.slider("Petal Length (cm)", 1.0, 7.0, 1.4)
petal_width = st.slider("Petal Width (cm)", 0.1, 3.0, 0.2)
st.markdown("---")
if st.button("๐Ÿ” Predict", use_container_width=True):
with st.spinner("Calling ML API..."):
try:
response = requests.post(API_URL, json={
"sepal_length": sepal_length,
"sepal_width": sepal_width,
"petal_length": petal_length,
"petal_width": petal_width
})
result = response.json()
st.success(f"๐ŸŒบ Prediction: **{result['prediction']}**")
st.info(f"๐Ÿ“Š Confidence: **{result['confidence']}%**")
except Exception as e:
st.error(f"API Error: {e}")
st.markdown("---")
st.markdown("Built with โค๏ธ | FastAPI + Docker + Render + Hugging Face")