AI Flash Fiction Generator

import streamlit as st

from openai import OpenAI

import textwrap


# Initialize API

client = OpenAI(api_key="YOUR_OPENAI_API_KEY")


st.set_page_config(page_title="AI Flash Fiction Generator", page_icon="šŸ“–", layout="centered")


st.title("šŸ“– AI Flash Fiction Generator")

st.caption("Enter a theme or mood → Get a 100-word short story instantly!")


theme = st.text_input("✨ Enter a theme (e.g., hope, mystery, space, love):")


if st.button("Generate Story"):

    if theme.strip() == "":

        st.warning("Please enter a theme!")

    else:

        with st.spinner("Generating your story..."):

            prompt = f"Write a 100-word flash fiction story about '{theme}'. The story should be complete, emotional, and end with a twist."


            response = client.chat.completions.create(

                model="gpt-3.5-turbo",

                messages=[

                    {"role": "system", "content": "You are a creative storyteller who writes short fiction."},

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

                ],

                temperature=0.9,

                max_tokens=200

            )


            story = response.choices[0].message.content.strip()

            story = textwrap.fill(story, width=80)


            st.subheader("šŸŖ„ Your 100-Word Story:")

            st.write(story)


            st.success("Done! You can regenerate by changing the theme.")


The Top Programming Languages 2025 - IEEE Spectrum

In the “Spectrum” default ranking, which is weighted with the interests of IEEE members in mind, we see that once again Python has the top spot, with the biggest change in the top five being JavaScript’s drop from third place last year to sixth place this year.




Source: https://spectrum.ieee.org/top-programming-languages-2025

Smart Image Color Palette Extractor

import cv2

import numpy as np

from sklearn.cluster import KMeans

from tkinter import Tk, filedialog

from PIL import Image

import matplotlib.pyplot as plt


def rgb_to_hex(rgb):

    """Convert RGB tuple to HEX string."""

    return "#{:02x}{:02x}{:02x}".format(int(rgb[0]), int(rgb[1]), int(rgb[2]))


def extract_colors(image_path, num_colors=6):

    """Extract dominant colors from an image using KMeans clustering."""

    # Read and convert image

    image = cv2.imread(image_path)

    image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)

    

    # Reshape image data for clustering

    pixels = image.reshape((-1, 3))

    pixels = np.float32(pixels)


    # Apply K-Means

    kmeans = KMeans(n_clusters=num_colors, random_state=42)

    kmeans.fit(pixels)

    

    colors = np.round(kmeans.cluster_centers_).astype(int)

    return colors


def display_palette(colors):

    """Display color palette using matplotlib."""

    plt.figure(figsize=(10, 2))

    plt.axis("off")


    # Create palette blocks

    for i, color in enumerate(colors):

        plt.subplot(1, len(colors), i + 1)

        plt.imshow(np.ones((100, 100, 3), dtype=np.uint8) * np.uint8(color))

        plt.title(rgb_to_hex(color), fontsize=10)

        plt.axis("off")


    plt.tight_layout()

    plt.show()


def main():

    # GUI File Picker

    root = Tk()

    root.withdraw()

    image_path = filedialog.askopenfilename(title="Select an Image",

                                            filetypes=[("Image Files", "*.jpg *.jpeg *.png *.bmp")])

    if not image_path:

        print("❌ No file selected.")

        return


    print(f"šŸ“ø Analyzing: {image_path}")

    colors = extract_colors(image_path, num_colors=6)

    

    print("\nšŸŽØ Dominant Colors:")

    for color in colors:

        print(f"RGB: {tuple(color)} | HEX: {rgb_to_hex(color)}")


    # Show palette visually

    display_palette(colors)


if __name__ == "__main__":

    main()


Offline Python compiler apps for Android

  • Pydroid 3:

    Features: A complete offline Python 3 IDE with a built-in interpreter, pip package manager, and a custom repository for pre-built packages of scientific libraries like NumPy, SciPy, and TensorFlow. 

    Other tools: Includes a C, C++, and Fortran compiler, a PDB debugger, and support for Tkinter, Kivy, and PySide6. 

    Availability: Free on the Google Play Store

  • pyIDE:

    Features: A free, user-friendly offline Python compiler for writing and running code on your device without an internet connection. 

    Best for: Beginners looking to practice Python on the go. 

    Availability: Available for download on the Softonic website

  • QPython 3L:

    Features: An app that allows you to run Python 3 on your Android device without an internet connection. 

    Availability: Found on the Google Play Store

Medical Symptom Checker

APP.PY

import os

import pandas as pd

from flask import Flask, render_template, request

from openai import OpenAI


app = Flask(__name__)

client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))


# Load demo dataset

conditions_df = pd.read_csv("conditions.csv")


@app.route("/", methods=["GET", "POST"])

def index():

    suggestions = None

    disclaimer = "⚠️ This tool is for educational/demo purposes only. It does not provide medical advice. Please consult a doctor for any health concerns."

    

    if request.method == "POST":

        user_symptoms = request.form.get("symptoms").lower()

        matched = conditions_df[conditions_df["symptom"].isin(user_symptoms.split(","))]


        # Aggregate suggestions from dataset

        dataset_suggestions = matched[["possible_condition", "severity"]].drop_duplicates()


        # AI-generated reasoning

        try:

            ai_prompt = f"""

            You are a medical assistant (for demo purposes only). 

            Based on the symptoms: {user_symptoms}, suggest a few possible conditions.

            Provide only educational hints, and include a note advising to consult a doctor.

            """

            response = client.chat.completions.create(

                model="gpt-4o-mini",

                messages=[{"role": "user", "content": ai_prompt}],

                temperature=0.6,

            )

            ai_output = response.choices[0].message.content

        except Exception as e:

            ai_output = f"(AI service unavailable: {e})"


        suggestions = {

            "user_symptoms": user_symptoms,

            "dataset": dataset_suggestions.to_dict(orient="records"),

            "ai_output": ai_output,

            "disclaimer": disclaimer

        }


    return render_template("index.html", suggestions=suggestions)

    

if __name__ == "__main__":

    app.run(debug=True)


index.html


<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <title>Medical Symptom Checker (Demo)</title>

    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">

    <style>

        body { background: #f8f9fa; }

        .container { max-width: 700px; margin-top: 50px; }

        .card { box-shadow: 0 0 10px rgba(0,0,0,0.1); }

    </style>

</head>

<body>

<div class="container">

    <h2 class="text-center mb-4">🩺 Medical Symptom Checker (Demo)</h2>

    <form method="POST" class="card p-4">

        <label for="symptoms" class="form-label">Enter your symptoms (comma-separated):</label>

        <input type="text" id="symptoms" name="symptoms" class="form-control" placeholder="e.g. fever, sore throat, headache" required>

        <button type="submit" class="btn btn-primary mt-3 w-100">Check Possible Conditions</button>

    </form>


    {% if suggestions %}

    <div class="card mt-4 p-4">

        <h5>Entered Symptoms:</h5>

        <p>{{ suggestions.user_symptoms }}</p>


        {% if suggestions.dataset %}

        <h5>Dataset-based Suggestions:</h5>

        <ul>

            {% for item in suggestions.dataset %}

            <li>{{ item.possible_condition }} — <strong>{{ item.severity }}</strong> severity</li>

            {% endfor %}

        </ul>

        {% endif %}


        <h5>AI Analysis:</h5>

        <p>{{ suggestions.ai_output }}</p>


        <div class="alert alert-warning mt-3">

            {{ suggestions.disclaimer }}

        </div>

    </div>

    {% endif %}

</div>

</body>

</html>