|
import streamlit as st
|
|
import pandas as pd
|
|
import joblib
|
|
from sklearn.preprocessing import LabelEncoder
|
|
|
|
|
|
model = joblib.load("clicks_predictor_model.pkl")
|
|
|
|
st.title("📊 Marketing Campaign Click Predictor")
|
|
st.markdown("Kampanya özelliklerine göre tahmini tıklama sayısını öğrenin.")
|
|
|
|
|
|
company = st.selectbox("Şirket", ["Innovate Industries", "NexGen Systems", "Alpha", "TechCorp", "DataTech Solutions"])
|
|
campaign_type = st.selectbox("Kampanya Türü", ["Email", "Influencer", "Search", "Social Media"])
|
|
target_audience = st.selectbox("Hedef Kitle", ["Men 18-24", "Women 35-44", "All Ages", "Men 25-34"])
|
|
duration = st.selectbox("Süre", ["15 days", "30 days", "45 days", "60 days"])
|
|
channel = st.selectbox("Kanal", ["Google Ads", "YouTube", "Facebook", "Instagram", "Website", "Email"])
|
|
acquisition_cost = st.number_input("Müşteri Kazanım Maliyeti ($)", value=1000.0)
|
|
location = st.selectbox("Konum", ["Chicago", "New York", "Los Angeles", "Miami", "Houston"])
|
|
language = st.selectbox("Dil", ["Spanish", "German", "French", "Mandarin", "English"])
|
|
impressions = st.number_input("İzlenim Sayısı", value=1000)
|
|
engagement = st.slider("Etkileşim Skoru", 0, 10, 5)
|
|
customer_segment = st.selectbox("Müşteri Segmenti", ["Health & Wellness", "Fashionistas", "Outdoor Adventurers", "Tech Enthusiasts", "Foodies"])
|
|
|
|
|
|
input_df = pd.DataFrame({
|
|
"Company": [company],
|
|
"Campaign_Type": [campaign_type],
|
|
"Target_Audience": [target_audience],
|
|
"Duration": [duration],
|
|
"Channel_Used": [channel],
|
|
"Acquisition_Cost": [acquisition_cost],
|
|
"Location": [location],
|
|
"Language": [language],
|
|
"Impressions": [impressions],
|
|
"Engagement_Score": [engagement],
|
|
"Customer_Segment": [customer_segment]
|
|
})
|
|
|
|
|
|
def encode_input(df):
|
|
for col in df.columns:
|
|
if df[col].dtype == 'object':
|
|
df[col] = LabelEncoder().fit_transform(df[col])
|
|
return df
|
|
|
|
input_encoded = encode_input(input_df)
|
|
|
|
|
|
if st.button("Tahmin Et"):
|
|
prediction = model.predict(input_encoded)[0]
|
|
st.success(f"📈 Tahmini Tıklama Sayısı: {int(prediction)}")
|
|
|