Observed since 20 Oct, 17:40 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
abstract-hugging-face
Lazy-loaded HuggingFace utilities for summarization, OCR, embeddings, and video pipelines
Description: A batteries-included bridge between your abstract_* ecosystem and popular Hugging Face–style NLP/Speech models. It packages local model runners, text utilities, video→audio→transcribe→summarize workflows, and optional Flask blueprints so you can expose everything over HTTP with almost no glue code.
https://github.com/AbstractEndeavors/abstract_hugpyputkoffVideo intelligence pipeline
yt_dlp)moviepy/ffmpeg)VideoDirectoryManager)Summarization
Keywords & embeddings
Generation helpers
distilgpt2) and helper to build public asset URLsDeepCoder (local LLM) integration
Drop-in HTTP APIs (Flask blueprints)
/download_video, /extract_video_audio, /get_video_whisper_*, /get_video_*path, etc./deepcoder_generatepyproject.toml[build-system]
requires = ["setuptools>=68", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "abstract-hugging-face"
version = "0.1.0"
description = "Lazy-loaded HuggingFace utilities for summarization, OCR, embeddings, and video pipelines"
readme = "README.md"
requires-python = ">=3.10"
authors = [
{name = "Abstract Endeavors"}
]
dependencies = [
"huggingface_hub>=0.23",
"numpy",
"regex",
]
# ------------------------------------------------------------------
# Optional dependency groups
# ------------------------------------------------------------------
[project.optional-dependencies]
ml = [
"torch>=2.2",
"transformers>=4.40",
"sentence-transformers>=2.6",
"keybert>=0.8",
"accelerate>=0.30",
]
ocr = [
"paddleocr",
"opencv-python",
"pdf2image",
]
nlp = [
"spacy>=3.7",
]
video = [
"moviepy",
"openai-whisper",
]
full = [
"torch>=2.2",
"transformers>=4.40",
"sentence-transformers>=2.6",
"keybert>=0.8",
"accelerate>=0.30",
"spacy>=3.7",
"moviepy",
"openai-whisper",
"paddleocr",
"opencv-python",
"pdf2image",
]
# ------------------------------------------------------------------
# CLI entrypoints (optional but very useful)
# ------------------------------------------------------------------
[project.scripts]
abstract-models = "abstract_hugging_face.cli:main"
pip install .
Installs only lightweight dependencies.
pip install .[ml]
Installs:
torch
transformers
sentence-transformers
keybert
accelerate
pip install .[ocr]
Installs:
paddleocr
opencv-python
pdf2image
pip install .[full]
PyTorch CUDA builds cannot be safely pinned in a package, so you should document this in README.
Example GPU install:
pip install torch --index-url https://download.pytorch.org/whl/cu121
pip install abstract-hugging-face[ml]
CPU:
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install abstract-hugging-face[ml]
Given your modules, a clean layout would be:
abstract_hugging_face/
│
├── __init__.py
├── config.py
├── lazy_import.py
├── models.py
│
├── summarizers/
│ ├── falcon_flan_t5.py
│ └── chunk_utils.py
│
├── embeddings/
│ ├── keybert_manager.py
│ └── similarity.py
│
├── ocr/
│ ├── paddle_ocr.py
│ └── preprocess.py
│
├── video/
│ ├── whisper_transcribe.py
│ └── audio_extract.py
│
└── cli.py
Since your system uses:
ensure_model()
you can expose it via CLI.
Example cli.py:
import sys
from .models import ensure_model, list_models
def main():
if len(sys.argv) < 2:
print("Available models:", ", ".join(list_models()))
return
model = sys.argv[1]
path = ensure_model(model)
print("Model ready at:", path)
Then users can run:
abstract-models summarizer
and it downloads automatically.
Your project uses:
This structure:
✔ keeps installs small ✔ avoids downloading models during install ✔ supports modular usage ✔ matches your registry system
You should add a model cache lock to prevent multiple workers downloading the same model simultaneously.
This happens a lot when running:
It’s a 10-line addition but prevents corrupted models.
abstract_hugpy/
abstract_hugpy.py # convenience import
routes.py # re-exports model helpers
video_utils.py # VideoDirectoryManager + video pipeline API
create/get_video_url_bp.py # codegen helpers for Flask blueprints
hugging_face_flasks/
deep_coder_flask.py
proxy_video_url_flask.py
video_url_flask.py
hugging_face_models/
config.py # DEFAULT_PATHS to local model dirs
whisper_model.py
summarizer_model.py
google_flan.py
keybert_model.py
falcon_flan_t5_summarizers.py
bigbird_module.py
generation.py
deepcoder.py
Local model/checkpoint locations are centralized in hugging_face_models/config.py:
DEFAULT_PATHS = {
"whisper": "/mnt/24T/hugging_face/modules/whisper_base",
"keybert": "/mnt/24T/hugging_face/modules/all_minilm_l6_v2",
"summarizer_t5": "/mnt/24T/hugging_face/modules/text_summarization/",
"flan": "google/flan-t5-xl",
"deepcoder": "/mnt/24T/hugging_face/modules/DeepCoder-14B",
}
You can override these at call time where functions accept a *_path or model_directory parameter.
Video cache root defaults to '/mnt/24T/hugging_face/videos' (video_utils.VIDEOS_DIRECTORY). If that path doesn’t exist on your machine, either:
get_abs_videos_directory(...) before use.Environment variables used by the proxy blueprint
DEEPCODER_FLASK_PORT – local port serving deepcoder_generateVIDEO_URL_FLASK_PORT – local port serving video endpointsfrom abstract_hugpy.hugging_face_models.summarizer_model import summarize
text = "Long content ..."
summary = summarize(text, summary_mode="medium") # short|medium|long|auto
print(summary)
from abstract_hugpy.hugging_face_models.keybert_model import refine_keywords
info = refine_keywords(
full_text="Your document goes here",
top_n=10, diversity=0.5, use_mmr=True
)
print(info["combined_keywords"], info["keyword_density"])
from abstract_hugpy.hugging_face_models.whisper_model import whisper_transcribe, extract_audio_from_video
audio_path = extract_audio_from_video("/path/to/video.mp4") # creates audio.wav next to video
result = whisper_transcribe(audio_path, model_size="small", language="english")
print(result["text"])
from abstract_hugpy.video_utils import (
download_video, extract_video_audio,
get_video_whisper_text, get_video_metadata, get_video_captions
)
url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
download_video(url) # cache info + mp4
extract_video_audio(url) # cache audio.wav
text = get_video_whisper_text(url) # transcribe (caches whisper_result.json)
meta = get_video_metadata(url) # summary + keywords (caches video_metadata.json)
srt = get_video_captions(url) # captions.srt
print(meta["title"])
from abstract_hugpy.hugging_face_models.deepcoder import get_deep_coder
dc = get_deep_coder() # uses DEFAULT_PATHS["deepcoder"]
out = dc.generate(prompt="Write a Python function that checks if a number is prime.", max_new_tokens=256)
print(out)
You can expose the modules via Flask in minutes.
from flask import Flask
from abstract_hugpy.hugging_face_flasks.video_url_flask import video_url_bp
from abstract_hugpy.hugging_face_flasks.deep_coder_flask import deep_coder_bp
from abstract_hugpy.hugging_face_flasks.proxy_video_url_flask import proxy_video_url_bp
app = Flask(__name__)
app.register_blueprint(video_url_bp)
app.register_blueprint(deep_coder_bp)
app.register_blueprint(proxy_video_url_bp)
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5005, debug=True)
All accept POST/GET with body like:
{ "url": "https://www.youtube.com/watch?v=..." }
| Endpoint | Purpose | Returns |
|---|---|---|
/download_video | Download/cache the video & info | video info dict |
/extract_video_audio | Ensure audio.wav exists | path or ok |
/get_video_whisper_result | Full Whisper JSON | {text, segments, ...} |
/get_video_whisper_text | Transcribed text only | str |
/get_video_whisper_segments | Segment list | list[dict] |
/get_video_metadata | {title, description, keywords} | dict |
/get_video_captions | Generate .srt | content/path |
/get_video_info | yt-dlp info | dict |
/get_video_directory | cached folder path | str |
/get_video_path | mp4 path | str |
/get_video_audio_path | audio path | str |
/get_video_srt_path | captions path | str |
/get_video_metadata_path | metadata path | str |
Example
curl -X POST http://localhost:5005/get_video_whisper_text \
-H "Content-Type: application/json" \
-d '{"url":"https://www.youtube.com/watch?v=dQw4w9WgXcQ"}'
| Endpoint | Body | Notes |
|---|---|---|
/deepcoder_generate | Arbitrary JSON passed to DeepCoder.generate(**data) | Expects keys like prompt, max_new_tokens, etc. |
Example
curl -X POST http://localhost:5005/deepcoder_generate \
-H "Content-Type: application/json" \
-d '{"prompt":"Write a Python Fibonacci function.", "max_new_tokens":256}'
If you run the real services on separate local ports, enable the proxy blueprint and set:
DEEPCODER_FLASK_PORTVIDEO_URL_FLASK_PORTThe proxy exposes the same routes under /api/* and forwards requests to the local services.
YouTube URL
│
▼
VideoDirectoryManager (per-ID folder)
├── info.json (yt_dlp)
├── video.mp4
├── audio.wav (moviepy/ffmpeg)
├── whisper_result.json (OpenAI Whisper local)
├── captions.srt
└── video_metadata.json (summary + keywords)
Most modules log via abstract_utilities.get_logFile(__name__). Check your configured log directory for traces (e.g., video extraction progress, errors).
yt_dlp supports; mind site TOS.http://localhost:{PORT}—use only within trusted networks and put a reverse proxy (Nginx) in front of it for auth/SSL if exposed publicly.video_utils.VideoDirectoryManagerget_data(video_url=None, video_id=None) -> dictdownload_video(video_url) -> dictextract_audio(video_url) -> strget_whisper_result(video_url) -> dictget_metadata(video_url) -> dict (summary+keywords)get_captions(video_url) -> str (loads/export SRT)Convenience functions mirror the above:
download_video(...), extract_video_audio(...), get_video_whisper_text(...), etc.
hugging_face_models.summarizer_modelsummarize(text, summary_mode='medium', max_chunk_tokens=450, min_length=None, max_length=None) -> strhugging_face_models.keybert_modelrefine_keywords(full_text, top_n=10, ...) -> dictextract_keywords(text|list[str], top_n=5, ...) -> list[...]hugging_face_models.whisper_modelwhisper_transcribe(audio_path, model_size='small', language='english', ...) -> dictextract_audio_from_video(video_path, audio_path=None) -> str|Nonehugging_face_models.deepcoderget_deep_coder(module_path=None, torch_dtype=None, use_quantization=True) -> DeepCoderDeepCoder.generate(prompt|messages, max_new_tokens=..., use_chat_template=False, ...) -> strffmpeg not found
Install it (sudo apt-get install ffmpeg). MoviePy/yt-dlp rely on it.
spaCy model: OSError: [E050] Can't find model 'en_core_web_sm'
python -m spacy download en_core_web_sm
CUDA OOM / very slow inference
tiny/base), smaller T5, or run on CPU.use_quantization=True) and reduce max_new_tokens.Permission errors under /mnt/24T/...
DEFAULT_PATHS and VIDEOS_DIRECTORY to locations you own.moviepy audio write hangs
Ensure the input file has an audio stream; upgrade moviepy; verify ffmpeg.
yt_dlp network errors
Update yt_dlp and retry, or use cookies/proxy if needed.
Current package version: 0.0.0.40 (alpha)
PRs welcome! Please:
SingletonMeta, path helpers).MIT © Abstract Endeavors
Remote inference instead of local heavy models If you don’t need air-gapped/offline ops, delegating summarization/ASR to hosted APIs (e.g., Hugging Face Inference Endpoints, OpenAI Whisper API) can drastically simplify setup and reduce infra friction. You could wrap those calls behind the same Flask blueprints used here.
Faster keywording at scale
For massive batch jobs, a simpler TF-IDF or RAKE pipeline (e.g., scikit-learn, rake-nltk) may be faster and “good enough.” Keep abstract_hugpy for high-value content where semantic quality matters.
Video processing queue
If you’re ingesting thousands of URLs, a message queue (RabbitMQ/Redis) with worker pods running only video_utils calls might be more resilient than synchronous Flask calls. You already use RabbitMQ elsewhere—easy to slot in.
Model management
For multi-host deployments, consider HF safetensors checkpoints + text-generation-inference or vLLM as a backend and adapt deepcoder.py to call remote generation instead of local AutoModelForCausalLM. This offloads VRAM juggling and gives you token-streaming, parallelism, and metrics “for free.”
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
huggingface_hubEnvironment{
"extras": "",
"marker": null,
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | huggingface_hub>=0.23 | runtime |
numpyEnvironment{
"extras": "",
"marker": null,
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | numpy | runtime |
regexEnvironment{
"extras": "",
"marker": null,
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | regex | runtime |
torchEnvironment{
"extras": "",
"marker": "extra == \"ml\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | torch>=2.2; extra == "ml" | runtime |
transformersEnvironment{
"extras": "",
"marker": "extra == \"ml\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | transformers>=4.40; extra == "ml" | runtime |
sentence-transformersEnvironment{
"extras": "",
"marker": "extra == \"ml\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | sentence-transformers>=2.6; extra == "ml" | runtime |
keybertEnvironment{
"extras": "",
"marker": "extra == \"ml\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | keybert>=0.8; extra == "ml" | runtime |
accelerateEnvironment{
"extras": "",
"marker": "extra == \"ml\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | accelerate>=0.30; extra == "ml" | runtime |
paddleocrEnvironment{
"extras": "",
"marker": "extra == \"ocr\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | paddleocr; extra == "ocr" | runtime |
opencv-pythonEnvironment{
"extras": "",
"marker": "extra == \"ocr\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | opencv-python; extra == "ocr" | runtime |
pdf2imageEnvironment{
"extras": "",
"marker": "extra == \"ocr\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | pdf2image; extra == "ocr" | runtime |
spacyEnvironment{
"extras": "",
"marker": "extra == \"nlp\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | spacy>=3.7; extra == "nlp" | runtime |
moviepyEnvironment{
"extras": "",
"marker": "extra == \"video\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | moviepy; extra == "video" | runtime |
openai-whisperEnvironment{
"extras": "",
"marker": "extra == \"video\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | openai-whisper; extra == "video" | runtime |
torchEnvironment{
"extras": "",
"marker": "extra == \"full\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | torch>=2.2; extra == "full" | runtime |
transformersEnvironment{
"extras": "",
"marker": "extra == \"full\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | transformers>=4.40; extra == "full" | runtime |
sentence-transformersEnvironment{
"extras": "",
"marker": "extra == \"full\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | sentence-transformers>=2.6; extra == "full" | runtime |
keybertEnvironment{
"extras": "",
"marker": "extra == \"full\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | keybert>=0.8; extra == "full" | runtime |
accelerateEnvironment{
"extras": "",
"marker": "extra == \"full\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | accelerate>=0.30; extra == "full" | runtime |
spacyEnvironment{
"extras": "",
"marker": "extra == \"full\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | spacy>=3.7; extra == "full" | runtime |
moviepyEnvironment{
"extras": "",
"marker": "extra == \"full\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | moviepy; extra == "full" | runtime |
openai-whisperEnvironment{
"extras": "",
"marker": "extra == \"full\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | openai-whisper; extra == "full" | runtime |
paddleocrEnvironment{
"extras": "",
"marker": "extra == \"full\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | paddleocr; extra == "full" | runtime |
opencv-pythonEnvironment{
"extras": "",
"marker": "extra == \"full\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | opencv-python; extra == "full" | runtime |
pdf2imageEnvironment{
"extras": "",
"marker": "extra == \"full\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | pdf2image; extra == "full" | runtime |
abstract_securityEnvironment{
"extras": "",
"marker": "extra == \"full\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | abstract_security; extra == "full" | runtime |
bs4Environment{
"extras": "",
"marker": "extra == \"full\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | bs4; extra == "full" | runtime |
abstract_aiEnvironment{
"extras": "",
"marker": "extra == \"full\"",
"requires_python": ">=3.6",
"evaluation": "NOT_EVALUATED"
} | abstract_ai; extra == "full" | runtime |
bdist_wheel · 29.31 KB · Python py3
sdist · 24.36 KB · Python source
Shared repository data · GitHub
Observed since 20 Oct, 17:40 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:45e4e6961ac2f597c38fae07112243bbaed2c65ae89358ff0f5d9c8f4520ff02