Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -33,27 +33,31 @@ def get_recycling_suggestions_from_groq(item, quantity):
|
|
33 |
)
|
34 |
return chat_completion.choices[0].message.content
|
35 |
|
36 |
-
# Sidebar
|
37 |
st.sidebar.title("π RecycleSmart-PK")
|
|
|
|
|
|
|
38 |
st.sidebar.markdown("### Navigation")
|
39 |
section = st.sidebar.radio(
|
40 |
"Choose a section:",
|
41 |
-
["Home", "Recycle Suggestions", "
|
42 |
)
|
43 |
-
st.sidebar.markdown("---")
|
44 |
-
st.sidebar.image("https://media.giphy.com/media/26xBI73gWquCBBCDe/giphy.gif", use_column_width=True)
|
45 |
|
46 |
-
# Main Content
|
47 |
if section == "Home":
|
48 |
st.title("β»οΈ Welcome to RecycleSmart-PK!")
|
49 |
st.markdown(
|
50 |
"""
|
51 |
### π Your Smart Recycling Assistant π
|
52 |
-
|
53 |
Select items to recycle, get creative suggestions, and see how much COβ you can reduce!
|
54 |
"""
|
55 |
)
|
56 |
-
st.image(
|
|
|
|
|
|
|
57 |
|
58 |
elif section == "Recycle Suggestions":
|
59 |
st.title("π‘ Recycling Suggestions")
|
@@ -61,7 +65,7 @@ elif section == "Recycle Suggestions":
|
|
61 |
"π¦ Select items to recycle:",
|
62 |
list(carbon_reduction_data.keys())
|
63 |
)
|
64 |
-
quantities = {item: st.number_input(f"Enter quantity for {item} (in kg):", min_value=0, step=1
|
65 |
|
66 |
if st.button("Get Suggestions"):
|
67 |
if selected_items:
|
@@ -76,30 +80,12 @@ elif section == "Recycle Suggestions":
|
|
76 |
st.write(f"π‘ {llm_response}")
|
77 |
st.write(f"π **Carbon Footprint Reduction**: {carbon_reduction:.2f} kg COβ")
|
78 |
st.markdown("---")
|
79 |
-
|
80 |
st.write("### π Total Carbon Footprint Reduction π")
|
81 |
st.write(f"π **{total_carbon_reduction:.2f} kg COβ saved**")
|
82 |
st.success("π Great job contributing to a greener planet!")
|
83 |
else:
|
84 |
st.error("β Please select at least one item and specify its quantity.")
|
85 |
|
86 |
-
elif section == "Carbon Impact":
|
87 |
-
st.title("π Carbon Impact Analysis")
|
88 |
-
st.markdown(
|
89 |
-
"""
|
90 |
-
### πΏ Why Recycling Matters
|
91 |
-
Recycling reduces waste in landfills, conserves natural resources, and lowers greenhouse gas emissions.
|
92 |
-
"""
|
93 |
-
)
|
94 |
-
st.image("https://media.giphy.com/media/l4FGn8AsM9v6KAcYE/giphy.gif", use_column_width=True)
|
95 |
-
st.markdown(
|
96 |
-
"""
|
97 |
-
#### π‘ Fun Fact:
|
98 |
-
Recycling one ton of plastic bottles saves **3.8 tons of COβ**!
|
99 |
-
Imagine the difference you can make!
|
100 |
-
"""
|
101 |
-
)
|
102 |
-
|
103 |
elif section == "FAQs":
|
104 |
st.title("π€ FAQs")
|
105 |
st.markdown(
|
@@ -115,7 +101,11 @@ elif section == "FAQs":
|
|
115 |
A: Visit local recycling centers or community initiatives.
|
116 |
"""
|
117 |
)
|
118 |
-
st.image(
|
|
|
|
|
|
|
|
|
119 |
|
120 |
|
121 |
|
|
|
33 |
)
|
34 |
return chat_completion.choices[0].message.content
|
35 |
|
36 |
+
# Sidebar with a relevant GIF and navigation
|
37 |
st.sidebar.title("π RecycleSmart-PK")
|
38 |
+
st.sidebar.image(
|
39 |
+
"https://media.giphy.com/media/26xBI73gWquCBBCDe/giphy.gif", use_container_width=True
|
40 |
+
)
|
41 |
st.sidebar.markdown("### Navigation")
|
42 |
section = st.sidebar.radio(
|
43 |
"Choose a section:",
|
44 |
+
["Home", "Recycle Suggestions", "FAQs"]
|
45 |
)
|
|
|
|
|
46 |
|
47 |
+
# Main Content
|
48 |
if section == "Home":
|
49 |
st.title("β»οΈ Welcome to RecycleSmart-PK!")
|
50 |
st.markdown(
|
51 |
"""
|
52 |
### π Your Smart Recycling Assistant π
|
53 |
+
Start reducing waste and improving the planet.
|
54 |
Select items to recycle, get creative suggestions, and see how much COβ you can reduce!
|
55 |
"""
|
56 |
)
|
57 |
+
st.image(
|
58 |
+
"https://media.giphy.com/media/3oEjI6SIIHBdRxXI40/giphy.gif",
|
59 |
+
use_container_width=True,
|
60 |
+
)
|
61 |
|
62 |
elif section == "Recycle Suggestions":
|
63 |
st.title("π‘ Recycling Suggestions")
|
|
|
65 |
"π¦ Select items to recycle:",
|
66 |
list(carbon_reduction_data.keys())
|
67 |
)
|
68 |
+
quantities = {item: st.number_input(f"Enter quantity for {item} (in kg):", min_value=0, step=1) for item in selected_items}
|
69 |
|
70 |
if st.button("Get Suggestions"):
|
71 |
if selected_items:
|
|
|
80 |
st.write(f"π‘ {llm_response}")
|
81 |
st.write(f"π **Carbon Footprint Reduction**: {carbon_reduction:.2f} kg COβ")
|
82 |
st.markdown("---")
|
|
|
83 |
st.write("### π Total Carbon Footprint Reduction π")
|
84 |
st.write(f"π **{total_carbon_reduction:.2f} kg COβ saved**")
|
85 |
st.success("π Great job contributing to a greener planet!")
|
86 |
else:
|
87 |
st.error("β Please select at least one item and specify its quantity.")
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
elif section == "FAQs":
|
90 |
st.title("π€ FAQs")
|
91 |
st.markdown(
|
|
|
101 |
A: Visit local recycling centers or community initiatives.
|
102 |
"""
|
103 |
)
|
104 |
+
st.image(
|
105 |
+
"https://media.giphy.com/media/3ohzdQ1IynzclJldUQ/giphy.gif",
|
106 |
+
use_container_width=True,
|
107 |
+
)
|
108 |
+
|
109 |
|
110 |
|
111 |
|