RecycleIt: An android app that helps you in recycling items with AI.
Your recycle pal.

RecycleIt is a cutting-edge android application designed to make recycling easy and efficient. Leveraging the power of ML Kit Image Labeling and Gemini AI, RecycleIt allows users to simply take a picture of any item and instantly receive detailed recycling instructions. By combining advanced machine learning technologies with a user-friendly interface, RecycleIt helps users identify recyclable materials and learn the best recycling practices, making a positive impact on the environment. Whether you're at home, at work, or on the go, RecycleIt is your go-to solution for smart and responsible recycling.
Application FLow
At first you have to take a picture of any item. This application uses SSImagePicker to capture image by CameraX api. Then this api returns the uri of the image from the device's storage. Then the uri is passed to ML Kit's on-device image labeling Api to identify the object. The sample code for the image labeling Api is given below. The model of this api is bundeled within the app.
private val labeler : ImageLabeler by lazy {
ImageLabeling.getClient(ImageLabelerOptions.DEFAULT_OPTIONS)
}
val image = InputImage.fromFilePath(this,uri)
labeler.process(image)
After processing the image the api returns the labels with the confidences. We choose the label with height confidence. Then a prompt with the label is sent to Google Gemini api to generate the text to text response. This app uses gemini-1.5-flash model for producing the responses. We use Markdown perser to convert markdown to html and display it on TypeWriterView. The code with the prompt is given below.
private val generativeModel : GenerativeModel by lazy {
GenerativeModel(
modelName = "gemini-1.5-flash",
apiKey = getString(R.string.ai_api_key)
)
}
labeler.process(image).addOnSuccessListener { labels ->
val imageCaption = labels[0].text
val prompt = "You are a recycle bot. You give quick steps to recycle, reduce or reuse waste material.\n" +
"Keep the ideas short and simple. Try to answer in less than 150 words. Use a bullet point format to make it more readable.\n" +
"Tell me what I can do with $imageCaption"
CoroutineScope(Dispatchers.IO).launch {
val response = generativeModel.generateContent(prompt)
val flavour = CommonMarkFlavourDescriptor()
val parsedTree = MarkdownParser(flavour).buildMarkdownTreeFromString(response.text!!)
val html = HtmlGenerator(response.text!!, parsedTree, flavour).generateHtml()
withContext(Dispatchers.Main){
binding.typeTextView.animateText(Html.fromHtml(html,Html.FROM_HTML_MODE_COMPACT))
}
}
}
Screenshoots are given below.


Opensource Code
The Github repository is given here.
The signed apk is available here.
Tech used
ML Kit Image Labeling: For detecting and identifying items.
Gemini AI: For providing recycling instructions.
Kotlin: For building the mobile application.
Conclusion
RecycleIt empowers individuals to take an active role in environmental conservation by simplifying the recycling process. By harnessing advanced technologies like ML Kit Image Labeling and Gemini AI, the app transforms the way we approach recycling, making it accessible, informative, and efficient. With RecycleIt, you can make a significant difference in reducing waste and promoting sustainable practices. Join us in our mission to create a cleaner, greener world—one item at a time. Thank you Hashnode for providing such opportunity to showcase our works.





