Spaces:
Build error
Build error
Esmaeilkiani
commited on
Commit
•
475c938
1
Parent(s):
6633234
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import joblib
|
3 |
+
import pandas as pd
|
4 |
+
|
5 |
+
# Load the trained model
|
6 |
+
model = joblib.load('sugar_cane_model.joblib')
|
7 |
+
|
8 |
+
st.title('Sugar Cane Properties Prediction')
|
9 |
+
|
10 |
+
# Input fields
|
11 |
+
farm = st.text_input('Farm Name')
|
12 |
+
variety = st.text_input('Variety')
|
13 |
+
age = st.text_input('Age')
|
14 |
+
|
15 |
+
if st.button('Predict'):
|
16 |
+
# Create a DataFrame with the input data
|
17 |
+
input_data = pd.DataFrame({'Farm': [farm], 'Variety': [variety], 'Age': [age]})
|
18 |
+
|
19 |
+
# Make prediction
|
20 |
+
prediction = model.predict(input_data)
|
21 |
+
|
22 |
+
# Display results
|
23 |
+
st.write('Predicted Properties:')
|
24 |
+
st.write(f'Brix: {prediction[0][0]:.2f}')
|
25 |
+
st.write(f'Purity: {prediction[0][1]:.2f}')
|
26 |
+
st.write(f'Pol: {prediction[0][2]:.2f}')
|
27 |
+
st.write(f'RS: {prediction[0][3]:.2f}')
|