| import streamlit as st |
| import pandas as pd |
| import numpy as np |
| import os |
|
|
| |
| os.environ["STREAMLIT_SERVER_FILE_WATCHER_TYPE"] = "none" |
|
|
| |
| st.set_page_config(page_title="Fast Food Nutrition Guide", layout="wide") |
|
|
| |
| @st.cache_data |
| def load_data(path): |
| try: |
| df = pd.read_csv(path) |
| df = df.replace([np.inf, -np.inf], np.nan).dropna() |
| return df |
| except: |
| return None |
|
|
| path = "Nutrition_Value_Dataset.csv" |
| df = load_data(path) |
|
|
| if df is None: |
| st.error("CSV file not found! / Veri seti dosyası bulunamadı!") |
| st.stop() |
|
|
| |
| st.sidebar.title("🏥 Health & Calorie Guide / Sağlık ve Kalori Rehberi") |
|
|
| st.sidebar.subheader("⚖️ Daily Calorie Needs / Günlük Kalori İhtiyacı") |
| st.sidebar.write(""" |
| - **Women / Kadınlar:** 2,000kcal |
| - **Men / Erkekler:** 2,500 kcal |
| """) |
|
|
| st.sidebar.warning(""" |
| ⚠️ **Health Advice / Sağlık Öğüdü:** Fast food meals are high in sodium and low in nutrients. |
| *Fast food öğünleri sodyum bakımından yüksek, besin değeri bakımından düşüktür.* |
| """) |
|
|
| st.sidebar.info(""" |
| 💡 **Quick Tip / Pratik Bilgi:** Choosing water over soda can reduce your meal's sugar content by 40-60g. |
| *Asitli içecek yerine su seçmek, öğününüzdeki şeker miktarını 40-60 gr azaltabilir.* |
| """) |
|
|
| |
| st.title("🍔 Global Fast Food Nutrition Analysis / Küresel Fast Food Besin Analizi") |
|
|
| |
| st.error("### 📢 Important Notice for Consumers / Tüketiciler İçin Önemli Not") |
|
|
| col_note_tr, col_note_en = st.columns(2) |
|
|
| with col_note_tr: |
| st.markdown(""" |
| **Aşağıdaki verilere istinaden, bu şirketlerden yemek tüketilmemesi sağlığınız için şu nedenlerle yararlı olacaktır:** |
| |
| 1. **Kalp Sağlığı:** Yüksek trans yağ ve sodyum içeriği damar sertliği ve tansiyona neden olur. |
| 2. **Kan Şekeri Dengesi:** Aşırı şeker ve işlenmiş karbonhidratlar ani insülin direnci ve diyabet riskini tetikler. |
| 3. **Besin Değeri Eksikliği:** Bu ürünler "boş kalori" kaynağıdır; vitamin, mineral ve lif açısından son derece fakirdir. |
| 4. **Obezite Riski:** **Pizza Hut, Burger King, KFC, McDonald’s ve Starbucks** şirketlerinden yüksek kalori yoğunluğu olacağından kısa sürede kontrolsüz kilo alımına yol açar. |
| |
| * **🥤 Su İçin:** Asitli içecekler yerine su tüketmek sağlığınız için kritiktir. |
| * **🥩 Protein Vurgusu:** Kas sağlığı ve metabolizma için **protein ağırlıklı** beslenmeye özen gösterilmelidir. |
| """) |
|
|
| with col_note_en: |
| st.markdown(""" |
| **Based on the data below, avoiding these companies' meals will benefit your health for the following reasons:** |
| |
| 1. **Heart Health:** High trans fat and sodium content cause arteriosclerosis and high blood pressure. |
| 2. **Blood Sugar Balance:** Excessive sugar and processed carbs trigger insulin resistance and diabetes risk. |
| 3. **Lack of Nutrients:** These products are sources of "empty calories"; they are extremely poor in vitamins and minerals. |
| 4. **Obesity Risk:** High calorie density in foods from companies like **Pizza Hut, Burger King, KFC, McDonald’s, and Starbucks** can lead to rapid, uncontrolled weight gain. |
| |
| * **🥤 Drink Water:** Choosing water instead of sugary drinks is critical for your health. |
| * **🥩 Focus on Protein:** Prioritize **protein-rich** nutrition for muscle health and metabolism. |
| """) |
|
|
| st.write("---") |
|
|
| |
| st.markdown(""" |
| <div style="text-align: center; border: 1px solid #ddd; padding: 15px; border-radius: 10px; background-color: #f9f9f9;"> |
| <h3 style="color: #1E1E1E; font-weight: bold; margin: 0;"> |
| 🔍 Bu çalışma, fast food ürünlerinin kalori ve şeker içeriklerini görselleştirerek genel bir sağlık tablosu sunmaktadır. |
| </h3> |
| <h4 style="color: #555555; margin: 10px 0 0 0;"> |
| This study provides a general health overview by visualizing the calorie and sugar content of fast food products. |
| </h4> |
| </div> |
| """, unsafe_allow_html=True) |
|
|
| st.write("---") |
|
|
| |
| st.subheader("📊 General Visual Analysis / Genel Görsel Analiz") |
|
|
| c1, c2 = st.columns(2) |
|
|
| with c1: |
| st.write("🍭 **Average Sugar by Company / Şirketlere Göre Ort. Şeker**") |
| sugar_means = df.groupby("Company")["Sugar (g)"].mean().sort_values() |
| st.bar_chart(sugar_means) |
|
|
| with c2: |
| st.write("🔥 **Overall Calorie Distribution / Genel Kalori Dağılımı**") |
| |
| counts, bin_edges = np.histogram(df["Energy (kCal)"], bins=20) |
| st.bar_chart(counts) |
|
|
| |
| st.write("---") |
| st.subheader("📋 High-Calorie Products List / Yüksek Kalorili Ürün Listesi") |
| top_20 = df.sort_values(by="Energy (kCal)", ascending=False).head(20) |
|
|
| st.dataframe( |
| top_20[["Company", "Product", "Energy (kCal)", "Sugar (g)", "Protein (g)", "Total Fat (g)"]], |
| use_container_width=True |
| ) |
|
|
| |
| st.write("---") |
| st.download_button( |
| "📥 Download Full Dataset / Tüm Veriyi İndir", |
| df.to_csv(index=False), |
| "fastfood_nutrition_final.csv", |
| "text/csv" |
| ) |