|
|
import streamlit as st
|
|
|
import pandas as pd
|
|
|
import joblib
|
|
|
|
|
|
|
|
|
model = joblib.load("mushroom_model.pkl")
|
|
|
|
|
|
|
|
|
features = [
|
|
|
'cap-shape', 'cap-surface', 'cap-color', 'bruises', 'odor',
|
|
|
'gill-attachment', 'gill-spacing', 'gill-size', 'gill-color',
|
|
|
'stalk-shape', 'stalk-root', 'stalk-surface-above-ring',
|
|
|
'stalk-surface-below-ring', 'stalk-color-above-ring',
|
|
|
'stalk-color-below-ring', 'veil-type', 'veil-color',
|
|
|
'ring-number', 'ring-type', 'spore-print-color',
|
|
|
'population', 'habitat'
|
|
|
]
|
|
|
|
|
|
|
|
|
st.title("🍄 Mushroom Classification")
|
|
|
st.write("Bu uygulama, verilen mantar özelliklerine göre yenilebilir mi yoksa zehirli mi olduğunu tahmin eder.")
|
|
|
|
|
|
|
|
|
user_input = {}
|
|
|
for feature in features:
|
|
|
user_input[feature] = st.selectbox(f"{feature.replace('-', ' ').capitalize()}:",
|
|
|
['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'])
|
|
|
|
|
|
|
|
|
if st.button("Tahmin Et"):
|
|
|
input_df = pd.DataFrame([user_input])
|
|
|
prediction = model.predict(input_df)[0]
|
|
|
|
|
|
if prediction == 'e':
|
|
|
st.success("✅ Tahmin: Edible (Yenilebilir)")
|
|
|
else:
|
|
|
st.error("❌ Tahmin: Poisonous (Zehirli)")
|
|
|
|