Skip to main content

Framewise SecureLine

Framewise SecureLine is a Python library for analyzing text and audio for security concerns. The library supports text-based detection and audio chunk predictions, offering flexibility for content security use cases.

Features

  • Text Detection: Analyze text for security concerns, such as banned topics, PII, or profanity.
  • Audio Chunk Analysis: Process audio data in chunks for classification and security predictions.
  • Custom Filters: Easily configure filters for denied topics, PII information, and word lists.
  • Extensibility: Supports structured outputs for easy integration with your workflows.
  • Robust Error Handling: Handles API errors, validation errors, and request timeouts gracefully.

Installation

Framewise SecureLine is available for installation using Poetry or pip.

Install using Poetry

poetry add framewise-secureline

Install using pip

pip install framewise-secureline

Getting Started

Initialization

To use Framewise SecureLine, you need an API key. Initialize the SecureLine client as shown below:

from framewise_secureline import SecureLine

# Initialize the client
client = SecureLine(
    api_key="your-api-key",
    denied_topics="medical diagnoses, competitors",
    ppi_information="SSN, Medical Records",
    word_filters="profanity",
)

Text Detection

Analyze a piece of text for security concerns.

result = client.detect("Sample text for analysis.")

# Access raw response
print(result)

Audio Chunk Analysis

Analyze an audio chunk for predictions. The library accepts a single chunk of type AudioSegment.

from pydub import AudioSegment

# Load an audio file and extract a chunk
audio = AudioSegment.from_file("/path/to/audio.mpga").set_frame_rate(16000).set_channels(1)
chunk = audio[:100]  # Extract first 100ms

# Analyze the chunk
result = client.analyze_audio_chunk(chunk)

# Access predictions
for prediction in result.predictions:
    print(f"Label: {prediction.label}, Score: {prediction.score}")
print(f"Latency: {result.latency}, Device: {result.device}")

Advanced Usage

Custom Filters

You can update the filters dynamically using the update_filters method:

client.update_filters(
    denied_topics="new denied topics",
    ppi_information="new PII types",
    word_filters="new word list",
)

Handling Multiple Audio Chunks

While SecureLine processes one audio chunk at a time, you can handle multiple chunks by iterating over the audio file:

chunks = [audio[i:i+100] for i in range(0, len(audio), 100)]  # Split into 100ms chunks

for i, chunk in enumerate(chunks):
    result = client.analyze_audio_chunk(chunk)
    print(f"Chunk {i}:")
    for prediction in result.predictions:
        print(f"  Label: {prediction.label}, Score: {prediction.score}")

Error Handling

Framewise SecureLine provides robust error handling for common scenarios:

  • ValidationError: Raised for invalid inputs (e.g., empty text, incorrect audio format).
  • APIError: Raised for server-side errors during API calls.
  • TimeoutError: Raised when an API call exceeds the timeout.

Example

from framewise_secureline.exceptions import ValidationError, APIError, TimeoutError

try:
    result = client.detect("text to analyze")
except ValidationError as e:
    print(f"Validation failed: {e}")
except APIError as e:
    print(f"API error: {e}")
except TimeoutError as e:
    print(f"Request timed out: {e}")

Testing

The library includes a comprehensive suite of tests.

Run Tests

poetry run pytest

Coverage Report

poetry run pytest --cov=framewise_secureline

Support

For any issues or feature requests, please contact:
Email: sigireddybalasai@gmail.com


License

This project is licensed under the MIT License. See the LICENSE file for details.


Release files for framewise-secureline 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for framewise-secureline 0.1.3
File Size Uploaded
framewise_secureline-0.1.3.tar.gz 7.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for framewise-secureline 0.1.3
File Interpreter ABI Platform
framewise_secureline-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 15.4 kB

Release files / framewise_secureline-0.1.3.tar.gz

Download URL framewise_secureline-0.1.3.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
425c3fc7a4ff83cec743baf8b2e55ca2df38b8435fbc419de49929da578cd1ed
BLAKE2b-256 checksum
How to use checksums
80b9b43e51e94a9126c1c00a8bf31b2296e680d5ae748f6c9d5d11be7628f859
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.12.3 Linux/6.8.0-1017-gcp

Release files / framewise_secureline-0.1.3-py3-none-any.whl

Download URL framewise_secureline-0.1.3-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c157bc40081112daec6f54ca1cbb8c2bdd1a014ae8b50bf48005df8e534a903f
BLAKE2b-256 checksum
How to use checksums
1207c968befae947961dcefdf8204be0eba1c773ca623a9e869c570d02b805aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.12.3 Linux/6.8.0-1017-gcp

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page