Commit History

Update READM.mdE
ae9d850
verified

prithvi123 commited on

Update READM.mdE
3d9a7c2
verified

prithvi123 commited on

Update READM.mdE
3784283
verified

prithvi123 commited on

Update READM.mdE
9895297
verified

prithvi123 commited on

Update READM.mdE
37ef502
verified

prithvi123 commited on

Update READM.mdE
32f790c
verified

vlithish commited on

Update READM.mdE
da654e7
verified

vlithish commited on

Update READM.mdE
2df3c67
verified

vlithish commited on

README
33ed2d5
verified

vlithish commited on

Rename README.md to READM.mdE
036ce65
verified

vlithish commited on

Update README.md
501620a
verified

vlithish commited on

Update app.py
2ac26ce
verified

vlithish commited on

import gradio as gr from PIL import Image import random # ------------------------------- # Simple classification logic # ------------------------------- def classify_item(image, description): categories = ["Recyclable", "Compostable", "Trash"] if description: desc = description.lower() if "banana" in desc or "food" in desc or "peel" in desc or "leaf" in desc: category = "Compostable" elif "plastic" in desc or "bottle" in desc or "can" in desc or "metal" in desc: category = "Recyclable" elif "paper" in desc and "greasy" not in desc: category = "Recyclable" elif "pizza box" in desc or "styrofoam" in desc or "chip bag" in desc: category = "Trash" else: category = random.choice(categories) elif image: # Placeholder – replace with ML model if you train one category = random.choice(categories) else: return "No input", "⚠️ Please upload an image or type a description." # Tips tips = { "Recyclable": "♻️ Rinse before recycling. Check local rules for plastics.", "Compostable": "🌱 Add to compost bin or green waste collection.", "Trash": "πŸ—‘οΈ Not recyclable. Consider reusable alternatives." } return category, tips.get(category, "Check local disposal guidelines.") # ------------------------------- # Gradio UI # ------------------------------- with gr.Blocks() as demo: gr.Markdown("# 🌍 EcoSort: Smart Waste Classifier") gr.Markdown("Upload an **image** or type a **description** to check if it's Recyclable, Compostable, or Trash.") with gr.Row(): image_input = gr.Image(type="pil", label="Upload Image") text_input = gr.Textbox(label="Or type a description (e.g., 'banana peel', 'plastic bottle')") output_label = gr.Label(label="Prediction") output_tip = gr.Textbox(label="Eco-Friendly Tip", interactive=False) btn = gr.Button("Classify") btn.click(fn=classify_item, inputs=[image_input, text_input], outputs=[output_label, output_tip]) demo.launch()
89f852d
verified

vlithish commited on

initial commit
7c91954
verified

vlithish commited on