Inspiration

I work as a Statistician and IT Professional at the University of Calabar Teaching Hospital (UCTH) in Calabar, Nigeria. Every day I see the gap firsthand: doctors and nurses need procedural training videos, but professional video production costs $500-$3,000 per video and weeks of production time. Most Nigerian teaching hospitals have no budget for this. Community health workers in rural areas have almost nothing. I built NarrateFlow to close that gap.

What It Does

NarrateFlow is an autonomous medical education video generator. A user enters a clinical procedure title, selects their audience level (community health worker, nurse, or doctor), and the pipeline generates a complete narrated training video in under 5 minutes:

  1. Script Generation - GPT-4o-mini writes a structured section-by-section instructional script with narration text and visual prompts
  2. Scene Image Generation - gpt-image-1 via Genblaze generates clinical illustrations for each section
  3. Critic Evaluation - GPT-4o-mini Vision evaluates every image for clinical accuracy and professionalism, automatically retrying if the score falls below threshold
  4. Narration Audio - TTS-1-HD via Genblaze generates professional audio narration for each section
  5. Video Assembly - ffmpeg combines scene images and narration audio into a complete MP4
  6. Provenance Storage - every asset, manifest, script, and pipeline log is uploaded to Backblaze B2 with SHA-256 tracking via Genblaze

How I Built It

The backend is FastAPI deployed on Render. The frontend is Streamlit with live job status polling and a keep-alive ping to maintain the Render free tier instance during the 4-5 minute pipeline run.

The Genblaze SDK orchestrates the full generative media pipeline. I used genblaze-openai for both image generation (gpt-image-1) and TTS narration (TTS-1-HD), and genblaze-s3 with S3StorageBackend configured for Backblaze B2. Every pipeline step runs through a fresh ObjectStorageSink with KeyStrategy.HIERARCHICAL, which automatically uploads each generated asset to B2 and writes a SHA-256 provenance manifest.

The agentic self-correction loop is the most interesting engineering challenge: after each image is generated, a multimodal critic call evaluates it against the clinical description. If visual_match < 0.65 or safety_flag = True or professionalism < 0.6, the pipeline automatically regenerates with a refined prompt — up to 3 retries per section.

Challenges I Faced

Genblaze Windows compatibility - The Genblaze SDK generates file:// URLs for local assets, but on Windows the URL encoding breaks the path parser in transfer.py. I patched _read_local_file at runtime to handle Windows drive letter paths correctly.

Render free tier pipeline management - The Render free tier kills background tasks when requests end. I solved this with non-daemon Python threads (daemon=False) that keep the process alive, file-based job persistence in /tmp so status checks survive instance

Built With

  • backblaze-b2
  • fastapi
  • ffmpeg
  • genblaze
  • gpt-image-1
  • openai-gpt-4o-mini
  • python
  • render
  • streamlit
  • tts-1-hd
Share this project:

Updates

Submission history