Mujtaba29 commited on
Commit
3ff9818
Β·
verified Β·
1 Parent(s): e61851e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -33
app.py CHANGED
@@ -3,10 +3,10 @@ import streamlit as st
3
  from groq import Groq
4
 
5
  # Set the Groq API key
6
- os.environ["GROQ_API_KEY"] = "key"
7
 
8
  # Initialize Groq client
9
- client = Groq(api_key=os.environ.get("key"))
10
 
11
  # Carbon footprint reduction data (kg CO2 per kg recycled)
12
  carbon_reduction_data = {
@@ -22,7 +22,6 @@ carbon_reduction_data = {
22
  # Function to call Groq LLM
23
  def get_recycling_suggestions_from_groq(item, quantity):
24
  prompt = (
25
- f"You are an expert in recycling and sustainability. "
26
  f"Suggest profitable and eco-friendly uses for {quantity} kg of {item}, "
27
  f"including household uses, ways to monetize them, and calculate carbon footprint reduction."
28
  )
@@ -33,36 +32,36 @@ def get_recycling_suggestions_from_groq(item, quantity):
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")
64
  selected_items = st.multiselect(
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}
@@ -86,25 +85,6 @@ elif section == "Recycle Suggestions":
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(
92
- """
93
- ### Common Questions
94
- **Q: How does RecycleSmart-PK calculate COβ‚‚ reduction?**
95
- A: We use predefined data for each item type based on average recycling benefits.
96
-
97
- **Q: Can I suggest new items?**
98
- A: Yes! Reach out to us, and we'll add more items to the list.
99
-
100
- **Q: How do I recycle items near me?**
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
 
 
3
  from groq import Groq
4
 
5
  # Set the Groq API key
6
+ os.environ["GROQ_API_KEY"] = "your_api_key"
7
 
8
  # Initialize Groq client
9
+ client = Groq(api_key=os.environ.get("GROQ_API_KEY"))
10
 
11
  # Carbon footprint reduction data (kg CO2 per kg recycled)
12
  carbon_reduction_data = {
 
22
  # Function to call Groq LLM
23
  def get_recycling_suggestions_from_groq(item, quantity):
24
  prompt = (
 
25
  f"Suggest profitable and eco-friendly uses for {quantity} kg of {item}, "
26
  f"including household uses, ways to monetize them, and calculate carbon footprint reduction."
27
  )
 
32
  )
33
  return chat_completion.choices[0].message.content
34
 
35
+ # Sidebar with clean navigation and image
36
  st.sidebar.title("🌍 RecycleSmart-PK")
37
  st.sidebar.image(
38
+ "https://via.placeholder.com/300x200?text=RecycleSmart+Logo",
39
+ use_container_width=True,
40
  )
41
  st.sidebar.markdown("### Navigation")
42
  section = st.sidebar.radio(
43
  "Choose a section:",
44
+ ["Home", "Recycle Suggestions"]
45
  )
46
 
47
  # Main Content
48
  if section == "Home":
49
  st.title("♻️ Welcome to RecycleSmart-PK!")
50
+ st.image(
51
+ "https://via.placeholder.com/800x400?text=Recycle+Smartly%2C+Save+Our+Planet",
52
+ use_container_width=True,
53
+ )
54
  st.markdown(
55
  """
56
+ RecycleSmart-PK helps you turn waste into opportunities while reducing your carbon footprint.
57
+ Start by selecting items you want to recycle from the **Recycle Suggestions** tab.
 
58
  """
59
  )
 
 
 
 
60
 
61
  elif section == "Recycle Suggestions":
62
  st.title("πŸ’‘ Recycling Suggestions")
63
  selected_items = st.multiselect(
64
+ "Select items to recycle:",
65
  list(carbon_reduction_data.keys())
66
  )
67
  quantities = {item: st.number_input(f"Enter quantity for {item} (in kg):", min_value=0, step=1) for item in selected_items}
 
85
  else:
86
  st.error("❗ Please select at least one item and specify its quantity.")
87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
 
89
 
90