import streamlit as st import matplotlib.pyplot as plt # Uygulama başlığı ve stil ayarları st.set_page_config(page_title="Etsy Profit Margin Calculator", layout="wide") # CSS for custom styling st.markdown(""" """, unsafe_allow_html=True) # Üst başlık ve açıklama st.markdown("

Calculate Your Profit Margin on Etsy, Don’t Make A LOSS!

", unsafe_allow_html=True) # Kullanıcı girdi alanları col1, col2, col3 = st.columns(3) with col1: st.markdown("
💰 Store Currency", unsafe_allow_html=True) currency = st.selectbox("Currency", ["USD", "EUR"]) st.markdown("
🌍 Store Location", unsafe_allow_html=True) location = st.selectbox("Location", ["US", "EU", "Other"]) with col2: st.markdown("
💲 Revenue", unsafe_allow_html=True) sale_price = st.number_input("Sale Price ($)", min_value=0.0) shipping_price = st.number_input("Shipping Price ($)", min_value=0.0) gift_wrap = st.number_input("Gift Wrap Price ($)", min_value=0.0) with col3: st.markdown("
💸 Cost", unsafe_allow_html=True) product_cost = st.number_input("Product Cost ($)", min_value=0.0) labor_cost = st.number_input("Labor Cost ($)", min_value=0.0) packaging_cost = st.number_input("Packaging Cost ($)", min_value=0.0) # Hesaplama if st.button("Hesapla", key="calculate"): total_revenue = sale_price + shipping_price + gift_wrap total_cost = product_cost + labor_cost + packaging_cost profit = total_revenue - total_cost profit_margin = (profit / total_revenue) * 100 if total_revenue > 0 else 0 # Sonuçları göster st.markdown("
📊 Results", unsafe_allow_html=True) st.write("Total Revenue: $", total_revenue) st.write("Total Cost: $", total_cost) st.write("Profit: $", profit) st.write("Profit Margin: ", f"{profit_margin:.2f}%") # Pasta grafiği labels = ["Cost", "Profit"] sizes = [total_cost, profit] colors = ["#ff9999", "#66b3ff"] fig1, ax1 = plt.subplots() ax1.pie(sizes, labels=labels, colors=colors, autopct='%1.1f%%', startangle=90) ax1.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle. st.pyplot(fig1)