Chemistry Molecule Visualizer

 import streamlit as st

from rdkit import Chem

from rdkit.Chem import Draw, Descriptors

import py3Dmol


def mol_to_3d_view(smiles):

    mol = Chem.MolFromSmiles(smiles)

    mb = Chem.AddHs(mol)

    Chem.EmbedMolecule(mb)

    mol_block = Chem.MolToMolBlock(mb)


    viewer = py3Dmol.view(width=400, height=400)

    viewer.addModel(mol_block, 'mol')

    viewer.setStyle({'stick': {}})

    viewer.zoomTo()

    return viewer


st.title("๐Ÿงช Chemistry Molecule Visualizer")


smiles = st.text_input("Enter SMILES string", "CC(=O)O")  # Acetic Acid


if smiles:

    mol = Chem.MolFromSmiles(smiles)

    

    if mol:

        st.subheader("๐Ÿ“Œ Molecular Structure (2D)")

        st.image(Draw.MolToImage(mol, size=(300, 300)))


        st.subheader("๐Ÿ”ฌ Properties")

        st.markdown(f"**Formula**: {Chem.rdMolDescriptors.CalcMolFormula(mol)}")

        st.markdown(f"**Molecular Weight**: {Descriptors.MolWt(mol):.2f} g/mol")


        st.subheader("๐Ÿงฌ 3D Structure")

        viewer = mol_to_3d_view(smiles)

        viewer_html = viewer._make_html()

        st.components.v1.html(viewer_html, height=450)

    else:

        st.error("Invalid SMILES string. Try again.")


Receipt Text Extractor & Analyzer

 OCR using pytesseract

from PIL import Image

import pytesseract


def extract_text_from_image(image_path):

    image = Image.open(image_path)

    text = pytesseract.image_to_string(image)

    return text

Parse Items and Prices with re

import re

def parse_items(raw_text):
    # Match lines like: "Bread 2.50" or "Milk ....... 1.25"
    pattern = r"([A-Za-z\s]+)\s+([\d]+\.\d{2})"
    matches = re.findall(pattern, raw_text)
    
    items = [{"item": item.strip(), "price": float(price)} for item, price in matches]
    
    total = sum(i["price"] for i in items)
    avg = total / len(items) if items else 0
    
    return items, total, avg

(Optional) Step 3: Streamlit Interface


import streamlit as st
from utils.text_parser import extract_text_from_image, parse_items
import tempfile
import pandas as pd

st.title("๐Ÿงพ Receipt Text Extractor & Analyzer")
uploaded_file = st.file_uploader("Upload Receipt Image", type=["jpg", "png", "jpeg"])

if uploaded_file:
    with tempfile.NamedTemporaryFile(delete=False) as tmp:
        tmp.write(uploaded_file.read())
        tmp_path = tmp.name

    raw_text = extract_text_from_image(tmp_path)
    items, total, avg = parse_items(raw_text)

    df = pd.DataFrame(items)
    st.subheader("๐Ÿ›’ Items Detected:")
    st.table(df)

    st.markdown(f"**Total Cost:** ₹{total:.2f}")
    st.markdown(f"**Average Item Cost:** ₹{avg:.2f}")

    # Download as CSV
    csv = df.to_csv(index=False).encode()
    st.download_button("๐Ÿ“ฅ Download CSV", csv, "receipt_data.csv", "text/csv")

Music Genre Classifier

 # utils/feature_extractor.py

import librosa

import numpy as np


def extract_features(file_path):

    y, sr = librosa.load(file_path, duration=30)

    mfccs = librosa.feature.mfcc(y=y, sr=sr, n_mfcc=40)

    mfccs_mean = np.mean(mfccs.T, axis=0)

    return mfccs_mean


from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
import pandas as pd
import joblib

# Load features (extracted previously)
df = pd.read_csv("features_dataset.csv")  # Your dataset with MFCC + genre
X = df.drop('genre', axis=1)
y = df['genre']

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)

clf = RandomForestClassifier()
clf.fit(X_train, y_train)

# Save model
joblib.dump(clf, "model/genre_model.pkl")


# app.py
import streamlit as st
import joblib
import numpy as np
from utils.feature_extractor import extract_features
import tempfile

# Load model
model = joblib.load("model/genre_model.pkl")

st.title("๐ŸŽต Music Genre Classifier")
st.write("Upload a music file to predict its genre")

uploaded_file = st.file_uploader("Choose a file", type=["mp3", "wav"])

if uploaded_file:
    # Save temporarily
    with tempfile.NamedTemporaryFile(delete=False) as tmp:
        tmp.write(uploaded_file.read())
        tmp_path = tmp.name

    # Extract features and predict
    features = extract_features(tmp_path)
    prediction = model.predict([features])[0]
    proba = model.predict_proba([features])

    st.success(f"Predicted Genre: **{prediction}**")
    st.bar_chart(proba[0])

Custom Dictionary Builder

 db.py

import sqlite3


def init_db():

    conn = sqlite3.connect("words.db")

    cursor = conn.cursor()

    cursor.execute('''CREATE TABLE IF NOT EXISTS dictionary (

                        id INTEGER PRIMARY KEY AUTOINCREMENT,

                        word TEXT,

                        language TEXT,

                        meaning TEXT,

                        synonyms TEXT,

                        audio_file TEXT)''')

    conn.commit()

    conn.close()


def add_word(word, lang, meaning, synonyms, audio_file):

    conn = sqlite3.connect("words.db")

    cursor = conn.cursor()

    cursor.execute("INSERT INTO dictionary (word, language, meaning, synonyms, audio_file) VALUES (?, ?, ?, ?, ?)",

                   (word, lang, meaning, synonyms, audio_file))

    conn.commit()

    conn.close()


def search_word(word):

    conn = sqlite3.connect("words.db")

    cursor = conn.cursor()

    cursor.execute("SELECT * FROM dictionary WHERE word = ?", (word,))

    result = cursor.fetchone()

    conn.close()

    return result

tts.py

from gtts import gTTS

import os


def generate_audio(word, lang='en'):

    tts = gTTS(text=word, lang=lang)

    audio_file = f"audio/{word}_{lang}.mp3"

    tts.save(audio_file)

    return audio_file

app.py

import tkinter as tk

from db import init_db, add_word, search_word

from tts import generate_audio

import os

from playsound import playsound


init_db()


def submit_word():

    word = entry_word.get()

    lang = entry_lang.get()

    meaning = entry_meaning.get()

    synonyms = entry_synonyms.get()

    audio_path = generate_audio(word, lang)

    add_word(word, lang, meaning, synonyms, audio_path)

    label_status.config(text="✅ Word added!")


def play_audio():

    word = entry_word.get()

    result = search_word(word)

    if result and os.path.exists(result[5]):

        playsound(result[5])

    else:

        label_status.config(text="❌ Audio not found.")


# GUI Setup

window = tk.Tk()

window.title("๐Ÿ“š Custom Dictionary Builder")

window.geometry("400x400")


entry_word = tk.Entry(window)

entry_word.insert(0, "Word")

entry_word.pack(pady=5)


entry_lang = tk.Entry(window)

entry_lang.insert(0, "Language Code (e.g., en, es)")

entry_lang.pack(pady=5)


entry_meaning = tk.Entry(window)

entry_meaning.insert(0, "Meaning")

entry_meaning.pack(pady=5)


entry_synonyms = tk.Entry(window)

entry_synonyms.insert(0, "Synonyms")

entry_synonyms.pack(pady=5)


tk.Button(window, text="Add Word", command=submit_word).pack(pady=10)

tk.Button(window, text="Play Pronunciation", command=play_audio).pack(pady=5)


label_status = tk.Label(window, text="")

label_status.pack(pady=10)


window.mainloop()



Language Codes for gTTS:

  • English: en

  • Hindi: hi

  • Spanish: es

  • French: fr

  • Malayalam: ml

  • Tamil: ta

Mindfulness & Focus Timer App

 main.py

import tkinter as tk

from timer import start_pomodoro

from breathing import start_breathing

from prompts import get_prompt


window = tk.Tk()

window.title("๐Ÿง  Mindfulness & Focus Timer")

window.geometry("400x300")


label = tk.Label(window, text="Welcome to Focus Time!", font=("Helvetica", 16))

label.pack(pady=10)


tk.Button(window, text="Start Pomodoro", command=start_pomodoro).pack(pady=10)

tk.Button(window, text="Breathing Exercise", command=start_breathing).pack(pady=10)

tk.Button(window, text="Get Mindfulness Prompt", command=lambda: label.config(text=get_prompt())).pack(pady=10)


window.mainloop()

timer.py

import time
import pygame
import threading

def play_sound():
    pygame.init()
    pygame.mixer.init()
    pygame.mixer.music.load("sounds/ding.wav")
    pygame.mixer.music.play()

def start_pomodoro():
    def run():
        print("Focus time started!")
        for i in range(25 * 60, 0, -1):
            mins, secs = divmod(i, 60)
            print(f"{mins:02d}:{secs:02d}", end='\r')
            time.sleep(1)
        play_sound()
        print("\nTime for a break!")

    threading.Thread(target=run).start()

breathing.py

import time
import threading

def start_breathing():
    def run():
        print("Follow the breathing pattern:")
        for _ in range(4):
            print("Inhale... ๐Ÿซ")
            time.sleep(4)
            print("Hold... ✋")
            time.sleep(4)
            print("Exhale... ๐Ÿ˜ฎ‍๐Ÿ’จ")
            time.sleep(4)
    threading.Thread(target=run).start()

prompts.py

import random

prompts = [
    "Breathe in clarity, breathe out stress.",
    "Focus on one thing at a time.",
    "You are in control of your day.",
    "Be here now. ๐ŸŒฑ",
    "Let go of what you can't control."
]

def get_prompt():
    return random.choice(prompts)