|
import streamlit as st |
|
import joblib |
|
import numpy as np |
|
|
|
|
|
model = joblib.load('random_forest_model.pkl') |
|
|
|
|
|
st.title("Power Prediction App") |
|
st.subheader("Enter the values for Current (I) and Resistance (R) to predict Power (P)") |
|
|
|
|
|
current = st.number_input("Current (I in Amps)", min_value=0.1, max_value=10.0, value=5.0, step=0.1) |
|
resistance = st.number_input("Resistance (R in Ohms)", min_value=1.0, max_value=100.0, value=50.0, step=1.0) |
|
|
|
|
|
if st.button("Predict Power"): |
|
|
|
prediction = model.predict([[current, resistance]]) |
|
|
|
|
|
st.write(f"Predicted Power (P) for I = {current} A and R = {resistance} Ω is: {prediction[0]:.2f} Watts") |
|
|