OGrohit commited on
Commit
f5153b8
·
verified ·
1 Parent(s): a8ab578

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +65 -0
app.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ st.set_page_config(page_title="Smart Waste Segregation Advisor")
4
+
5
+ st.title("♻️ AI-Powered Smart Waste Segregation Advisor")
6
+ st.subheader("SDG 12: Responsible Consumption and Production")
7
+
8
+ st.markdown("""
9
+ This tool helps users identify waste categories and provides guidance
10
+ for responsible disposal using AI-based reasoning.
11
+ """)
12
+
13
+ # Image upload (UI purpose)
14
+ uploaded_image = st.file_uploader("Upload an image of the waste item (optional)", type=["jpg", "png", "jpeg"])
15
+
16
+ # Optional text input
17
+ user_text = st.text_input("Optional: Describe the waste item")
18
+
19
+ st.divider()
20
+
21
+ if st.button("Analyze Waste"):
22
+ # Simulated image interpretation
23
+ if uploaded_image:
24
+ image_description = "An image showing a waste item uploaded by the user"
25
+ else:
26
+ image_description = "No image provided"
27
+
28
+ prompt = f"""
29
+ You are an AI-powered Smart Waste Segregation Advisor.
30
+
31
+ You will receive:
32
+ 1. A brief description of an uploaded image (assume the image shows a waste item)
33
+ 2. Optional text input from the user
34
+
35
+ Your tasks:
36
+ 1. Identify the waste item based on the input.
37
+ 2. Classify the item into one of the following categories:
38
+ - Wet Waste
39
+ - Dry Waste
40
+ - E-Waste
41
+ 3. Explain briefly why the item belongs to this category.
42
+ 4. Suggest the correct and safe disposal method.
43
+ 5. Explain the environmental impact if the item is disposed of incorrectly.
44
+
45
+ User Input:
46
+ Image description: {image_description}
47
+ Additional text: {user_text}
48
+ """
49
+
50
+ # Simulated AI response (semi-working prototype)
51
+ response = """
52
+ **Waste Category:** Dry Waste
53
+
54
+ **Reason:**
55
+ Plastic-based items are non-biodegradable and commonly recyclable.
56
+
57
+ **Disposal Method:**
58
+ Dispose of the item in a dry waste or recycling bin.
59
+
60
+ **Environmental Impact:**
61
+ Improper disposal can cause long-term pollution and harm wildlife.
62
+ """
63
+
64
+ st.markdown("### 🧠 AI Analysis Result")
65
+ st.markdown(response)