-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstreamlit.py
More file actions
42 lines (34 loc) · 1.46 KB
/
streamlit.py
File metadata and controls
42 lines (34 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import numpy as np
import streamlit as st
import pickle
import pandas as pd
from PIL import Image
pickle_in=open("iris_model.pkl","rb")
classifier=pickle.load(pickle_in)
def welcome():
return "Hello Guyz"
def Nikesh(SepalLengthCm,SepalWidthCm,PetalLengthCm,PetalWidthCm):
species_mapping = {0: "Setosa", 1: "Versicolor", 2: "Virginica"} # Add your species mapping here
prediction=classifier.predict([[SepalLengthCm,SepalWidthCm,PetalLengthCm,PetalWidthCm]])
species_name = species_mapping.get(prediction[0], "Unknown") # Map the prediction to species name
print(f"Prediction: {prediction[0]}, Species: {species_name}")
return species_name
def main():
st.title("iris flower prediction")
html_temp="""
<div style="backgrouund-color:tomato;padding:10px>"""
st.markdown(html_temp,unsafe_allow_html=True)
SepalLengthCm = st.text_input("SepalLengthCm","type Here")
SepalWidthCm = st.text_input("SepalWidthCm","type Here")
PetalLengthCm = st.text_input("PetalLengthCm","type here")
PetalWidthCm = st.text_input("PetalWidthCm","type here")
result = ""
if st.button("Predict"):
result=Nikesh(float(SepalLengthCm), float(SepalWidthCm), float(PetalLengthCm),
float(PetalWidthCm ))
st.success('The output is {}'.format(result))
if st.button("About"):
st.text("let's learn")
st.text("Built by Nikesh")
if __name__=='__main__':
main()