Skip to content

abhijithwarrier/AI-PyShorts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI-PyShorts

⚡ One-liner AI utilities for text, images, and data.

This repository contains short, practical AI scripts built on Hugging Face Transformers 🤗 and PyTorch 🔥.
The goal is simple: provide ready-to-use AI commands that require minimal setup and deliver instant results.


🧩 Table of Contents


✨ Features

📝 Text Summarization

Condenses long text into a shorter version while preserving the key meaning and context.

Example:

pyai summary "Artificial Intelligence is transforming industries..."

Output:

Artificial Intelligence is transforming industries. Here are some of the ways it's changing the way we work. Read more at CNN.com/AI.

😊 Sentiment Analysis

Identifies the emotional tone of text, classifying it as POSITIVE, NEGATIVE, or NEUTRAL.

Example:

pyai sentiment "I like this new AI Tool"

Output:

{'label': 'POSITIVE', 'score': 0.9992}

Example:

pyai sentiment "Oh.. This looks so terrible.."

Output:

{'label': 'NEGATIVE', 'score': 0.9997}

🖼 Image Caption Generator

Generates a concise, descriptive caption for an image — ideal for accessibility, tagging, and creative applications.

Example:

pyai caption "<path_to_the_image>"

Output:

Automatically generates a relevant caption for the provided image.

🌐 Translator

Effortlessly translates text from a source language to a target language — fast, accurate, and natural-sounding.

Example:

pyai translate "Hello. This is an example of AI translator command" --src en --tgt sp

Output:

Bonjour. C'est un exemple de commande de traducteur AI

🔍 Named Entity Recognition

Identifies and classifies entities in text such as people, organizations, locations, dates, and more, using a pre-trained Transformer model.

Example:

pyai ner "Python was created by Guido van Rossum in 1991 and is maintained by the Python Software Foundation in the U
nited States." --aggregation-strategy simple

Output:

Entity Label Confidence
Python MISC 0.933
Guido van Rossum PER 0.997
Python Software Foundation ORG 0.999
United States LOC 0.999

🔄 Paraphraser

Generates alternative versions of your text while preserving its original meaning — ideal for improving clarity, variety, or tone.

Example:

pyai paraphrase "Artificial Intelligence is transforming industries." --num 3

Output:

['Artificial Intelligence is changing industries.', 'Artificial Intelligence is changing the world.', 'Artificial intelligence is helping industries.']

🌍 Language Detection

The Language Detector tool analyzes your input text and identifies its language with high accuracy. It’s useful for routing multilingual content, preprocessing text for translation, or simply detecting what language a piece of text is written in.

Example:

 pyai detectlang "La inteligencia artificial está revolucionando la forma en que trabajamos y vivimos."

Output:

{'language': 'es', 'score': 0.984924852848053}

🔑 Keyword Extraction

Automatically extract the most important words and phrases from any text using transformer-based NLP models. This helps in summarization, topic discovery, and quick content insights without reading the entire text.

Example:

pyai keywords "Artificial Intelligence is transforming industries through automation and data-driven decision making." \
  --topk 8 --ngmin 1 --ngmax 2 --method mmr --diversity 0.6

Output:

Keyword Score
industries automation 0.701
automation data 0.588
artificial intelligence 0.548
transforming industries 0.453
driven decision 0.438
intelligence transforming 0.388
data 0.289
making 0.128

🔊 Text to Speech

Convert written text into natural-sounding speech with Hugging Face’s multilingual TTS models.
This script generates audio files (MP3/WAV) from any input text.

Example:

pyai tts "Hello, welcome to my AI-PyShorts Repo" --lang en --out pyai_shorts/audio/sample_output/sample_audio.wav

Output:

pyai_shorts/audio/sample_output/sample_audio.wav

🎧 Listen to the sample output


❓ Question Answering

Ask questions against a given context paragraph and get precise answers extracted from it.

Example:

pyai qa --context "Artificial Intelligence is changing healthcare and finance." --question "Which industries are being transformed by AI?"

Output:

healthcare and finance

🛠 Requirements

  • Python 3.11
  • See requirements.txt for all dependencies.

📥 Installation

  1. Clone the repository
git clone <repo-url>

cd AI-PyShorts
  1. Create & activate a virtual environment
python3.11 -m venv venv

source venv/bin/activate   # On Windows: venv\Scripts\activate 
  1. Install dependencies
pip install -r requirements.txt 
  1. Install the package in editable mode
pip install -e . 

▶️ Running the Project

Once installed, you can run the CLI directly:

pyai summary "Your text here..."

Or run through Python:

python -m pyai_shorts.cli summary "Your text here..."

About

One-liner AI utilities for text, images & data.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages