Download app.py from umanr18075/Model: direct link, hf CLI and curl.
- Browser
- Download file 975 Bytes
-
https://huggingface.co/umanr18075/Model/resolve/main/app.py
- Command line
-
hf download hf://umanr18075/Model/app.py
-
curl -L -o app.py https://huggingface.co/umanr18075/Model/resolve/main/app.py
975 Bytes
| import streamlit as st | |
| import joblib | |
| import numpy as np | |
| # Load the model from Hugging Face Model Hub (replace with your model's Hugging Face repository URL) | |
| model = joblib.load('random_forest_model.pkl') # If model is uploaded directly in the Space, this works. | |
| # Streamlit App Title | |
| st.title("Power Prediction App") | |
| st.subheader("Enter the values for Current (I) and Resistance (R) to predict Power (P)") | |
| # Input fields for Current (I) and Resistance (R) | |
| 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) | |
| # Button to make prediction | |
| if st.button("Predict Power"): | |
| # Predict the power using the trained model | |
| prediction = model.predict([[current, resistance]]) | |
| # Display the result | |
| st.write(f"Predicted Power (P) for I = {current} A and R = {resistance} Ω is: {prediction[0]:.2f} Watts") | |