# Multilingual Dubbing Job API

## PURPOSE
Sarvam Content Studio lets a creator upload one video, pick several target
languages, and get back a dubbed version "in your voice" in minutes. This project
builds the backend web service behind that flow: a FastAPI endpoint that accepts a
video upload plus a list of target languages, creates a dubbing job, and returns a
pollable status resource. It solves the core creator problem from the ad — instead
of "five scripts, five retakes," the API turns one submission into many language
outputs with a single call.

## WHY THIS MATTERS
The transcript's central idea is that the *same* video, voice, and explanation can
be "understood by many more people." That only works if a service can fan one
source asset out into N language variants and track each one. Students learn how to
model a fan-out job, validate an input language set, and expose clean REST verbs.

## HOW TO BUILD
Framework: **FastAPI** + **Pydantic**. Steps:
1. Define a `DubRequest` model with `video_url`, `target_languages`, `preserve_voice`.
2. POST `/dub` stores the job in an in-memory dict and returns a job id.
3. GET `/jobs/{id}` returns status and per-language output stubs.
4. Replace the stub dubber with the real Sarvam Content Studio call behind `# TODO`.

```python
@app.post("/dub", response_model=JobAccepted)
def create_dub(req: DubRequest) -> JobAccepted:
    job_id = str(uuid.uuid4())
    JOBS[job_id] = {"status": "queued", "req": req, "outputs": {}}
    return JobAccepted(job_id=job_id, languages=req.target_languages)
```

## WHEN TO USE IN PRODUCTION
Use it when a platform ingests creator uploads and must fan them out to a language
catalog with per-variant review. Good for self-serve dubbing portals, internal
media pipelines, and CMS integrations. Do NOT use an in-memory store for real
traffic — jobs must survive restarts and scale across workers (use a queue + DB).
Avoid it when only one language is ever needed; direct synchronous transcode is
simpler.

## HOW IT HELPS STUDENTS
Learners practise request modelling, async job patterns, and designing an API
contract that a frontend or CLI can consume. They see how a "few minutes" pipeline
becomes a pollable resource, a skill that transfers to any long-running media task.

## STARTER CODE
See `starter/main.py` for a runnable FastAPI skeleton with in-memory jobs, a
deterministic stub dubber, and `# TODO` markers for the real Sarvam API call.
