Spaces:
Sleeping
title: Media Gen Api
emoji: π
colorFrom: indigo
colorTo: pink
sdk: docker
pinned: false
short_description: FastAPI backend for Text-to-Audio, Image, and Video generato
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
ποΈ Media Generation API
A FastAPI-based backend to generate audio, images, video, and PPT from user inputs. Supports BLEU/CLIP metrics, token-based authentication, and stores metadata in SQLite/Postgres.
A modular, RESTful FastAPI solution that converts text input into:
- π₯ Video
- πΌοΈ Image/Graphics
- π Audio
π Features
- Text β Video: Tone, domain, and environment-aware video generation.
- Text β Audio: Context-aware voice synthesis with emotional tone and language support.
- Text β Graphics: Visual generation using parameter-based prompts.
- BLEU/CLIP metrics for prompt-output fidelity.
- Token-based authentication for secure API use.
- Dockerized for easy deployment
- Optional Streamlit/React UI
- Swagger UI:
http://localhost:8000/docs
π Project Structure
media-gen-api/ βββ app/ β βββ api/v1/ # Versioned API endpoints β βββ auth/ # Token-based auth β βββ services/ # Core media generation logic β βββ main.py # FastAPI entry point βββ tests/ # Unit/integration tests βββ requirements.txt βββ README.md
π¦ Installation
π Run Locally
- Clone repo & create virtual environment
git clone https://github.com/yourorg/media-gen-api.git cd media-gen-api python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
- Install dependencies
pip install -r requirements.txt
- Run the API
uvicorn app.main:app --reload
Access docs: http://127.0.0.1:8000/docs
π Authentication
Use Bearer in the Authorize button or headers.
π‘ API Endpoints Summary
Endpoint | Method | Description |
---|---|---|
/api/v1/audio/generate | POST | Generate audio from text |
/api/v1/image/generate | POST | Generate image from text |
/api/v1/video/generate | POST | Generate video from text |
/api/v1/download | GET | Download generated file |
###π¦ Deployment (Streamlit/Optional UI) Option 1: Run with Streamlit (for demo) streamlit run streamlit_ui.py
Option 2: Docker (Production-ready) docker build -t media-gen-api . docker run -p 8000:8000 media-gen-api
π Metrics Logging (Optional)
- BLEU score and CLIPScore (WIP)
- Latency, GPU/CPU tracking
- Log file: logs/generation.log
π Submission Checklist
- β RESTful modular architecture
- β Multi-format (MP4, PNG, WAV)
- β Token Auth + Swagger UI
- β Compatible with DD/PIB via API
- β Streamlit demo app (optional)