AI Image Caption Generator

 import numpy as np

import tensorflow as tf

from tensorflow.keras.applications.inception_v3 import InceptionV3, preprocess_input

from tensorflow.keras.preprocessing import image

from tensorflow.keras.models import Model, load_model

import pickle

import cv2

import streamlit as st

from PIL import Image


# Load Pretrained InceptionV3 Model for Image Feature Extraction

base_model = InceptionV3(weights='imagenet')

model = Model(inputs=base_model.input, outputs=base_model.layers[-2].output)


# Load Pretrained Captioning Model

captioning_model = load_model("image_captioning_model.h5")


# Load Tokenizer & Word Mappings

with open("tokenizer.pickle", "rb") as handle:

    tokenizer = pickle.load(handle)


max_length = 35  # Max caption length


# Extract Features from Image

def extract_features(img_path):

    img = image.load_img(img_path, target_size=(299, 299))

    img = image.img_to_array(img)

    img = np.expand_dims(img, axis=0)

    img = preprocess_input(img)

    feature_vector = model.predict(img)

    return feature_vector


# Generate Caption

def generate_caption(img_path):

    image_features = extract_features(img_path)

    caption = "startseq"

    

    for i in range(max_length):

        sequence = [tokenizer.word_index[word] for word in caption.split() if word in tokenizer.word_index]

        sequence = tf.keras.preprocessing.sequence.pad_sequences([sequence], maxlen=max_length)

        predicted_index = np.argmax(captioning_model.predict([image_features, sequence]), axis=-1)

        word = tokenizer.index_word.get(predicted_index[0], "")

        if word == "endseq":

            break

        caption += " " + word

    

    return caption.replace("startseq", "").replace("endseq", "").strip()


# Streamlit Web Interface

st.title("🖼️ AI Image Caption Generator")

uploaded_file = st.file_uploader("Upload an image...", type=["jpg", "png", "jpeg"])


if uploaded_file is not None:

    img = Image.open(uploaded_file)

    st.image(img, caption="Uploaded Image", use_column_width=True)

    

    # Save the uploaded image temporarily

    img_path = "temp.jpg"

    img.save(img_path)

    

    # Generate Caption

    with st.spinner("Generating Caption..."):

        caption_text = generate_caption(img_path)

    

    st.subheader("📝 Generated Caption:")

    st.write(caption_text)


AI Resume Scorer

 import fitz  # PyMuPDF for PDF parsing

import docx2txt

import spacy

import re

from collections import Counter

import tkinter as tk

from tkinter import filedialog, messagebox


# Load NLP Model (English)

nlp = spacy.load("en_core_web_sm")


# Job Description (Example)

job_description = """

We are looking for a Data Scientist with expertise in Python, Machine Learning, and Data Analysis.

Candidates must have experience with Pandas, NumPy, and Scikit-learn.

Strong communication and teamwork skills are required.

"""


# Function to extract text from PDF

def extract_text_from_pdf(pdf_path):

    text = ""

    doc = fitz.open(pdf_path)

    for page in doc:

        text += page.get_text()

    return text


# Function to extract text from DOCX

def extract_text_from_docx(docx_path):

    return docx2txt.process(docx_path)


# Function to clean and preprocess text

def clean_text(text):

    text = re.sub(r"\s+", " ", text)  # Remove extra spaces

    text = text.lower()  # Convert to lowercase

    return text


# Function to extract keywords using NLP

def extract_keywords(text):

    doc = nlp(text)

    keywords = [token.text for token in doc if token.is_alpha and not token.is_stop]

    return Counter(keywords)


# Function to score the resume

def score_resume(resume_text, job_description):

    resume_keywords = extract_keywords(resume_text)

    job_keywords = extract_keywords(job_description)


    # Calculate Keyword Match Score

    matched_keywords = sum((resume_keywords & job_keywords).values())

    total_keywords = sum(job_keywords.values())

    keyword_score = (matched_keywords / total_keywords) * 100 if total_keywords else 0


    # Readability Score (Basic: Word Count / Sentence Count)

    sentence_count = len(re.findall(r"[.!?]", resume_text))

    word_count = len(resume_text.split())

    readability_score = (word_count / (sentence_count + 1)) * 2  # Simplified readability measure


    # Final Score Calculation (Weighted Average)

    final_score = (keyword_score * 0.7) + (readability_score * 0.3)

    return round(final_score, 2), keyword_score, readability_score


# GUI for File Upload

def upload_file():

    file_path = filedialog.askopenfilename(filetypes=[("PDF Files", "*.pdf"), ("Word Files", "*.docx")])

    

    if file_path:

        if file_path.endswith(".pdf"):

            resume_text = extract_text_from_pdf(file_path)

        elif file_path.endswith(".docx"):

            resume_text = extract_text_from_docx(file_path)

        else:

            messagebox.showerror("Error", "Unsupported file format!")

            return

        

        # Clean and score resume

        cleaned_resume = clean_text(resume_text)

        final_score, keyword_score, readability_score = score_resume(cleaned_resume, job_description)

        

        # Show results

        messagebox.showinfo("Resume Score", f"📄 Resume Score: {final_score}%\n\n"

                                             f"🔑 Keyword Match: {keyword_score:.2f}%\n"

                                             f"📖 Readability Score: {readability_score:.2f}%")


# GUI Setup

root = tk.Tk()

root.title("AI Resume Scorer")

root.geometry("300x200")


upload_btn = tk.Button(root, text="Upload Resume", command=upload_file, padx=10, pady=5)

upload_btn.pack(pady=20)


root.mainloop()


Job Application Tracker

 import tkinter as tk

from tkinter import ttk, messagebox

import sqlite3

import pandas as pd

import smtplib


# Database Setup

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

cursor = conn.cursor()

cursor.execute("""

    CREATE TABLE IF NOT EXISTS jobs (

        id INTEGER PRIMARY KEY AUTOINCREMENT,

        company TEXT,

        role TEXT,

        date_applied TEXT,

        status TEXT

    )

""")

conn.commit()


# GUI Application

class JobTrackerApp:

    def __init__(self, root):

        self.root = root

        self.root.title("Job Application Tracker")

        self.root.geometry("600x400")


        # Labels

        ttk.Label(root, text="Company:").grid(row=0, column=0)

        ttk.Label(root, text="Role:").grid(row=1, column=0)

        ttk.Label(root, text="Date Applied:").grid(row=2, column=0)

        ttk.Label(root, text="Status:").grid(row=3, column=0)


        # Entry Fields

        self.company_entry = ttk.Entry(root)

        self.role_entry = ttk.Entry(root)

        self.date_entry = ttk.Entry(root)

        self.status_combo = ttk.Combobox(root, values=["Pending", "Interview", "Rejected", "Hired"])

        

        self.company_entry.grid(row=0, column=1)

        self.role_entry.grid(row=1, column=1)

        self.date_entry.grid(row=2, column=1)

        self.status_combo.grid(row=3, column=1)


        # Buttons

        ttk.Button(root, text="Add Job", command=self.add_job).grid(row=4, column=0)

        ttk.Button(root, text="Show Jobs", command=self.show_jobs).grid(row=4, column=1)

        ttk.Button(root, text="Export to CSV", command=self.export_csv).grid(row=5, column=0)

        ttk.Button(root, text="Send Follow-up", command=self.send_followup).grid(row=5, column=1)


    def add_job(self):

        company = self.company_entry.get()

        role = self.role_entry.get()

        date = self.date_entry.get()

        status = self.status_combo.get()


        if not company or not role or not date or not status:

            messagebox.showerror("Error", "All fields are required!")

            return

        

        cursor.execute("INSERT INTO jobs (company, role, date_applied, status) VALUES (?, ?, ?, ?)", 

                       (company, role, date, status))

        conn.commit()

        messagebox.showinfo("Success", "Job Application Added!")


    def show_jobs(self):

        jobs_window = tk.Toplevel(self.root)

        jobs_window.title("Job Applications")

        tree = ttk.Treeview(jobs_window, columns=("ID", "Company", "Role", "Date", "Status"), show="headings")

        tree.heading("ID", text="ID")

        tree.heading("Company", text="Company")

        tree.heading("Role", text="Role")

        tree.heading("Date", text="Date Applied")

        tree.heading("Status", text="Status")

        tree.pack(fill="both", expand=True)


        cursor.execute("SELECT * FROM jobs")

        for row in cursor.fetchall():

            tree.insert("", "end", values=row)


    def export_csv(self):

        cursor.execute("SELECT * FROM jobs")

        data = cursor.fetchall()

        df = pd.DataFrame(data, columns=["ID", "Company", "Role", "Date Applied", "Status"])

        df.to_csv("job_applications.csv", index=False)

        messagebox.showinfo("Exported", "Job Applications saved as CSV!")


    def send_followup(self):

        email = "your-email@gmail.com"  # Change to your email

        password = "your-password"  # Use App Password for security


        cursor.execute("SELECT company, role FROM jobs WHERE status='Pending'")

        pending_jobs = cursor.fetchall()


        if not pending_jobs:

            messagebox.showinfo("No Follow-ups", "No pending applications to follow up on.")

            return

        

        msg = "Subject: Follow-up on Job Applications\n\n"

        msg += "Here are your pending job applications:\n"

        for company, role in pending_jobs:

            msg += f"- {role} at {company}\n"


        try:

            server = smtplib.SMTP("smtp.gmail.com", 587)

            server.starttls()

            server.login(email, password)

            server.sendmail(email, email, msg)

            server.quit()

            messagebox.showinfo("Email Sent", "Follow-up email sent successfully!")

        except Exception as e:

            messagebox.showerror("Error", f"Failed to send email: {e}")


# Run App

root = tk.Tk()

app = JobTrackerApp(root)

root.mainloop()


Automated Email Responder

 import imaplib

import smtplib

import email

from email.mime.text import MIMEText

import openai


# Gmail Credentials

EMAIL_USER = "your_email@gmail.com"

EMAIL_PASS = "your_app_password"


# OpenAI API Key (Optional)

OPENAI_API_KEY = "your_openai_api_key"

openai.api_key = OPENAI_API_KEY


# Connect to Gmail Inbox

def check_inbox():

    mail = imaplib.IMAP4_SSL("imap.gmail.com")

    mail.login(EMAIL_USER, EMAIL_PASS)

    mail.select("inbox")


    _, messages = mail.search(None, "UNSEEN")

    email_ids = messages[0].split()


    for email_id in email_ids:

        _, msg_data = mail.fetch(email_id, "(RFC822)")

        for response_part in msg_data:

            if isinstance(response_part, tuple):

                msg = email.message_from_bytes(response_part[1])

                sender = msg["From"]

                subject = msg["Subject"]

                body = extract_body(msg)


                print(f"New Email from: {sender}")

                print(f"Subject: {subject}")

                print(f"Body: {body}")


                reply_message = generate_reply(body)

                send_email(sender, reply_message)


    mail.logout()


# Extract Email Body

def extract_body(msg):

    if msg.is_multipart():

        for part in msg.walk():

            if part.get_content_type() == "text/plain":

                return part.get_payload(decode=True).decode()

    return msg.get_payload(decode=True).decode()


# Generate AI-Based Response (Optional)

def generate_reply(user_query):

    prompt = f"Reply professionally to this email: {user_query}"

    response = openai.ChatCompletion.create(

        model="gpt-3.5-turbo",

        messages=[{"role": "system", "content": "You are a professional email assistant."},

                  {"role": "user", "content": prompt}]

    )

    return response["choices"][0]["message"]["content"]


# Send Email Response

def send_email(to_email, message):

    smtp_server = smtplib.SMTP_SSL("smtp.gmail.com", 465)

    smtp_server.login(EMAIL_USER, EMAIL_PASS)


    msg = MIMEText(message)

    msg["Subject"] = "Re: Your Inquiry"

    msg["From"] = EMAIL_USER

    msg["To"] = to_email


    smtp_server.sendmail(EMAIL_USER, to_email, msg.as_string())

    smtp_server.quit()

    print(f"Auto-reply sent to {to_email}")


# Run the Email Bot

if __name__ == "__main__":

    check_inbox()


YouTube Video Summarizer

 pip install youtube-transcript-api nltk sumy


import tkinter as tk
from tkinter import messagebox
from youtube_transcript_api import YouTubeTranscriptApi
from sumy.parsers.plaintext import PlaintextParser
from sumy.nlp.tokenizers import Tokenizer
from sumy.summarizers.lsa import LsaSummarizer

# Function to extract video ID from URL
def extract_video_id(url):
    if "youtube.com/watch?v=" in url:
        return url.split("v=")[1].split("&")[0]
    elif "youtu.be/" in url:
        return url.split("youtu.be/")[1].split("?")[0]
    else:
        return None

# Function to fetch transcript
def get_transcript(video_url):
    video_id = extract_video_id(video_url)
    if not video_id:
        messagebox.showerror("Error", "Invalid YouTube URL")
        return None

    try:
        transcript = YouTubeTranscriptApi.get_transcript(video_id)
        full_text = " ".join([entry["text"] for entry in transcript])
        return full_text
    except Exception as e:
        messagebox.showerror("Error", f"Could not fetch transcript: {str(e)}")
        return None

# Function to summarize text
def summarize_text(text, num_sentences=3):
    parser = PlaintextParser.from_string(text, Tokenizer("english"))
    summarizer = LsaSummarizer()
    summary = summarizer(parser.document, num_sentences)
    return " ".join(str(sentence) for sentence in summary)

# Function to fetch and summarize
def summarize_video():
    video_url = url_entry.get()
    transcript = get_transcript(video_url)
    
    if transcript:
        summary = summarize_text(transcript)
        output_text.delete("1.0", tk.END)
        output_text.insert(tk.END, summary)

# GUI
root = tk.Tk()
root.title("YouTube Video Summarizer")

tk.Label(root, text="Enter YouTube Video URL:").pack()
url_entry = tk.Entry(root, width=50)
url_entry.pack()

tk.Button(root, text="Summarize", command=summarize_video).pack()

output_text = tk.Text(root, height=10, width=60)
output_text.pack()

root.mainloop()

Automated Screenshot Tool

 pip install pyautogui


import pyautogui
import time
import os
import tkinter as tk
from tkinter import messagebox

# Folder to save screenshots
screenshot_folder = "screenshots"
if not os.path.exists(screenshot_folder):
    os.makedirs(screenshot_folder)

# Function to take a screenshot
def take_screenshot():
    timestamp = time.strftime("%Y-%m-%d_%H-%M-%S")
    filename = os.path.join(screenshot_folder, f"screenshot_{timestamp}.png")
    screenshot = pyautogui.screenshot()
    screenshot.save(filename)
    print(f"✅ Screenshot saved: {filename}")

# Function to start auto screenshots
def start_screenshot():
    try:
        interval = int(entry.get())
        messagebox.showinfo("Started", f"Taking screenshots every {interval} seconds.")
        
        while True:
            take_screenshot()
            time.sleep(interval)
    except ValueError:
        messagebox.showerror("Error", "Please enter a valid number.")

# GUI with Tkinter
root = tk.Tk()
root.title("Automated Screenshot Tool")

tk.Label(root, text="Enter Screenshot Interval (seconds):").pack()
entry = tk.Entry(root)
entry.pack()

tk.Button(root, text="Start Screenshot Capture", command=start_screenshot).pack()
tk.Button(root, text="Exit", command=root.quit).pack()

root.mainloop()

Invoice Generator

 pip install reportlab


from reportlab.lib.pagesizes import letter
from reportlab.pdfgen import canvas

def generate_invoice(client_name, items, tax_rate=0.05, filename="invoice.pdf"):
    c = canvas.Canvas(filename, pagesize=letter)
    width, height = letter

    # Title
    c.setFont("Helvetica-Bold", 16)
    c.drawString(50, height - 50, "INVOICE")

    # Client Details
    c.setFont("Helvetica", 12)
    c.drawString(50, height - 80, f"Client: {client_name}")

    # Table Headers
    c.setFont("Helvetica-Bold", 12)
    c.drawString(50, height - 120, "Item")
    c.drawString(250, height - 120, "Quantity")
    c.drawString(350, height - 120, "Price")
    c.drawString(450, height - 120, "Total")

    # Invoice Items
    c.setFont("Helvetica", 12)
    y_position = height - 140
    total_cost = 0

    for item, details in items.items():
        quantity, price = details
        total = quantity * price
        total_cost += total

        c.drawString(50, y_position, item)
        c.drawString(250, y_position, str(quantity))
        c.drawString(350, y_position, f"${price:.2f}")
        c.drawString(450, y_position, f"${total:.2f}")
        y_position -= 20

    # Tax and Total Calculation
    tax_amount = total_cost * tax_rate
    grand_total = total_cost + tax_amount

    c.setFont("Helvetica-Bold", 12)
    c.drawString(350, y_position - 20, "Subtotal:")
    c.drawString(450, y_position - 20, f"${total_cost:.2f}")

    c.drawString(350, y_position - 40, f"Tax ({tax_rate * 100}%):")
    c.drawString(450, y_position - 40, f"${tax_amount:.2f}")

    c.drawString(350, y_position - 60, "Grand Total:")
    c.drawString(450, y_position - 60, f"${grand_total:.2f}")

    # Save PDF
    c.save()
    print(f"✅ Invoice saved as {filename}")

PDF to Audio Converter

 pip install PyMuPDF gtts tk


import fitz  # PyMuPDF
from gtts import gTTS
import tkinter as tk
from tkinter import filedialog, messagebox
import os

# Function to extract text from PDF
def extract_text_from_pdf(pdf_path):
    doc = fitz.open(pdf_path)
    text = ""
    for page in doc:
        text += page.get_text("text") + "\n"
    return text

# Function to convert text to speech
def convert_text_to_audio(text, output_file):
    if text.strip():
        tts = gTTS(text=text, lang='en')
        tts.save(output_file)
        messagebox.showinfo("Success", f"Audio file saved as {output_file}")
        os.system(f"start {output_file}")  # Opens the audio file
    else:
        messagebox.showwarning("Warning", "No text found in PDF.")

# Function to open file dialog
def select_pdf():
    file_path = filedialog.askopenfilename(filetypes=[("PDF Files", "*.pdf")])
    if file_path:
        text = extract_text_from_pdf(file_path)
        if text:
            convert_text_to_audio(text, "output_audio.mp3")

# Tkinter GUI Setup
root = tk.Tk()
root.title("PDF to Audio Converter 🔊")
root.geometry("400x200")

lbl_title = tk.Label(root, text="📄 PDF to Audio Converter 🔊", font=("Arial", 14, "bold"))
lbl_title.pack(pady=10)

btn_select_pdf = tk.Button(root, text="Select PDF & Convert", command=select_pdf, font=("Arial", 12))
btn_select_pdf.pack(pady=20)

root.mainloop()

Network Speed Monitor

 pip install speedtest-cli matplotlib tk


import speedtest
import tkinter as tk
from tkinter import ttk
import threading
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg

# Function to test internet speed
def test_speed():
    st = speedtest.Speedtest()
    st.get_best_server()
    
    download_speed = round(st.download() / 1_000_000, 2)  # Convert to Mbps
    upload_speed = round(st.upload() / 1_000_000, 2)  # Convert to Mbps

    return download_speed, upload_speed

# Function to update the speed in GUI
def update_speed():
    global speeds_download, speeds_upload
    
    while True:
        download, upload = test_speed()
        speeds_download.append(download)
        speeds_upload.append(upload)

        lbl_download.config(text=f"Download Speed: {download} Mbps")
        lbl_upload.config(text=f"Upload Speed: {upload} Mbps")

        update_graph()
        root.update_idletasks()

# Function to update the speed graph
def update_graph():
    ax.clear()
    ax.plot(speeds_download, label="Download Speed (Mbps)", color="blue")
    ax.plot(speeds_upload, label="Upload Speed (Mbps)", color="red")
    
    ax.set_title("Network Speed Over Time")
    ax.set_xlabel("Test Count")
    ax.set_ylabel("Speed (Mbps)")
    ax.legend()
    ax.grid()

    canvas.draw()

# Tkinter GUI setup
root = tk.Tk()
root.title("Network Speed Monitor 🌐")
root.geometry("500x500")

lbl_title = tk.Label(root, text="📡 Network Speed Monitor", font=("Arial", 14, "bold"))
lbl_title.pack(pady=10)

lbl_download = tk.Label(root, text="Download Speed: -- Mbps", font=("Arial", 12))
lbl_download.pack(pady=5)

lbl_upload = tk.Label(root, text="Upload Speed: -- Mbps", font=("Arial", 12))
lbl_upload.pack(pady=5)

# Matplotlib graph setup
fig, ax = plt.subplots(figsize=(5, 3))
speeds_download = []
speeds_upload = []

canvas = FigureCanvasTkAgg(fig, master=root)
canvas.get_tk_widget().pack()

# Run speed test in a separate thread
threading.Thread(target=update_speed, daemon=True).start()

root.mainloop()

Code Syntax Highlighter

 pip install pygments


from pygments import highlight
from pygments.lexers import guess_lexer, PythonLexer, JavascriptLexer, CLexer
from pygments.formatters import TerminalFormatter, HtmlFormatter

# Function to highlight code in terminal
def highlight_code_terminal(code, language="python"):
    # Choose lexer based on language
    lexer = {
        "python": PythonLexer(),
        "javascript": JavascriptLexer(),
        "c": CLexer(),
    }.get(language.lower(), guess_lexer(code))

    highlighted_code = highlight(code, lexer, TerminalFormatter())
    return highlighted_code


# Function to highlight code and save as HTML
def highlight_code_html(code, language="python", output_file="highlighted_code.html"):
    lexer = {
        "python": PythonLexer(),
        "javascript": JavascriptLexer(),
        "c": CLexer(),
    }.get(language.lower(), guess_lexer(code))

    formatter = HtmlFormatter(full=True, style="monokai")
    highlighted_code = highlight(code, lexer, formatter)

    # Save to an HTML file
    with open(output_file, "w", encoding="utf-8") as f:
        f.write(highlighted_code)
    
    print(f"✅ Highlighted code saved to {output_file}")

from pygments import highlight
from pygments.lexers import guess_lexer, PythonLexer, JavascriptLexer, CLexer
from pygments.formatters import TerminalFormatter, HtmlFormatter

# Function to highlight code in terminal
def highlight_code_terminal(code, language="python"):
    # Choose lexer based on language
    lexer = {
        "python": PythonLexer(),
        "javascript": JavascriptLexer(),
        "c": CLexer(),
    }.get(language.lower(), guess_lexer(code))

    highlighted_code = highlight(code, lexer, TerminalFormatter())
    return highlighted_code


# Function to highlight code and save as HTML
def highlight_code_html(code, language="python", output_file="highlighted_code.html"):
    lexer = {
        "python": PythonLexer(),
        "javascript": JavascriptLexer(),
        "c": CLexer(),
    }.get(language.lower(), guess_lexer(code))

    formatter = HtmlFormatter(full=True, style="monokai")
    highlighted_code = highlight(code, lexer, formatter)

    # Save to an HTML file
    with open(output_file, "w", encoding="utf-8") as f:
        f.write(highlighted_code)
    
    print(f"✅ Highlighted code saved to {output_file}")


# Example usage
if __name__ == "__main__":
    code_sample = """
    def greet(name):
        print(f"Hello, {name}!")
    
    greet("abc")
    """

    print("🎨 Terminal Highlighted Code:")
    print(highlight_code_terminal(code_sample, "python"))

    highlight_code_html(code_sample, "python")