framing-space / README.md
kodey175's picture
Update README.md
67131bf verified
|
Raw
History Blame Contribute Delete
1.18 kB

A newer version of the Gradio SDK is available: 6.20.0

Upgrade
metadata
title: MMahBot Framing Studio
emoji: 🖼️
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: 6.16.0
app_file: app.py
pinned: false
license: mit

MMahBot Framing Studio

Automatically crops or pads images to standard aspect ratios (9:16, 16:9, 1:1, 4:5) before watermarking or video generation.

Features

  • Aspect Ratios: 9:16 (Stories/Reels), 16:9 (YouTube), 1:1 (Posts), 4:5 (Portrait)
  • Modes:
    • crop: Center-crops the image (removes edges)
    • pad: Adds black borders to fit (preserves full image)

API Usage

import requests

API_URL = "https://kodey175-framing-space.hf.space/run/predict"

def frame_image(image_path, aspect="9:16", mode="crop"):
    with open(image_path, "rb") as f:
        import base64
        img_data = base64.b64encode(f.read()).decode()

    payload = {
        "data": [
            {"image": img_data},
            aspect,
            mode
        ]
    }

    response = requests.post(API_URL, json=payload)
    result = response.json()

    # Extract base64 result
    output_b64 = result['data'][0]['image']
    return output_b64

Gradio Interface

Visit the space URL to test interactively.