gk2410 commited on
Commit
ada2fd8
·
verified ·
1 Parent(s): 8f050d8

create app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from retriever import get_recommendations
3
+ from tools import estimate_footprint
4
+
5
+ st.set_page_config(page_title="EcoAdvisor 🌱", layout="centered")
6
+
7
+ st.title("🌍 EcoAdvisor")
8
+ st.markdown("#### Get personalized tips to live a more sustainable life.")
9
+
10
+ with st.form("sustainability_form"):
11
+ st.subheader("🏠 Your Lifestyle Details")
12
+
13
+ transport = st.selectbox("How do you usually commute?", ["Car", "Public Transport", "Cycle/Walk", "Electric Vehicle"])
14
+ diet = st.selectbox("Your diet type:", ["Meat-heavy", "Mixed", "Vegetarian", "Vegan"])
15
+ electricity = st.slider("Monthly electricity use (kWh)", 50, 1000, 300)
16
+ shopping_freq = st.selectbox("How often do you buy new clothes?", ["Every week", "Monthly", "Rarely", "Only when needed"])
17
+
18
+ submitted = st.form_submit_button("Get My Eco Plan")
19
+
20
+ if submitted:
21
+ footprint_score = estimate_footprint(transport, diet, electricity, shopping_freq)
22
+ recommendations = get_recommendations(transport, diet, electricity, shopping_freq)
23
+
24
+ st.success(f"♻️ Your estimated carbon impact score: **{footprint_score}/100** (lower is better)")
25
+ st.markdown("---")
26
+ st.subheader("🌱 Personalized Sustainability Tips")
27
+
28
+ for rec in recommendations:
29
+ st.markdown(f"- {rec}")