File size: 1,359 Bytes
b98c2d0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
import pandas as pd
import joblib

# Modeli yükle
model = joblib.load("mushroom_model.pkl")

# Özellikler listesi
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'
]

# Başlık
st.title("🍄 Mushroom Classification")
st.write("Bu uygulama, verilen mantar özelliklerine göre yenilebilir mi yoksa zehirli mi olduğunu tahmin eder.")

# Kullanıcı girişleri için alanlar
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'])

# Tahmin butonu
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)")