SoraWithAzure / README.md
levalencia's picture
first commit
6d01f39
metadata
title: SoraWithAzure
emoji: πŸš€
colorFrom: red
colorTo: red
sdk: docker
app_port: 8501
tags:
  - streamlit
pinned: false
short_description: Streamlit template space

SoraWithAzure: Streamlit Video Generation App

This app lets you generate videos using the Azure Sora API via a simple Streamlit interface. Users can enter a text prompt, select video settings, and generate videos that are stored and viewable by anyone using the app.

Key Components

  • SoraClient: Handles all communication with the Azure Sora API (job creation, polling, download).
  • VideoJob: Represents a video generation job, encapsulating prompt, parameters, and result.
  • VideoStorage: Handles saving and listing generated videos in a persistent directory.
  • Streamlit App: Provides the user interface for input, video generation, and video display.

How it Works

  1. User enters their Azure API key, endpoint, and a text prompt.
  2. User selects video resolution, length, and number of variants.
  3. The app creates a video generation job via the Sora API.
  4. The app polls for job completion.
  5. When ready, the app downloads the generated video(s) and stores them.
  6. All generated videos are listed and playable in the app.

Sequence Diagram (ASCII)

User           StreamlitApp      SoraClient      AzureSoraAPI      VideoStorage
 |                 |                |                |                |
 |---input-------->|                |                |                |
 |                 |---start_job--->|                |                |
 |                 |                |---POST-------->|                |
 |                 |                |<--job_id-------|                |
 |                 |<--job_id-------|                |                |
 |                 |---wait-------->|                |                |
 |                 |                |---poll-------->|                |
 |                 |                |<--status-------|                |
 |                 |<--result-------|                |                |
 |                 |---download---->|                |                |
 |                 |                |---GET video--->|                |
 |                 |                |<--video--------|                |
 |                 |                |---save-------->|                |
 |                 |                |<--file_path----|                |
 |<---display------|                |                |                |

Code Structure

  • src/sora_video_downloader.py: Core logic for Sora API interaction and video job management.
  • src/streamlit_app.py: Streamlit UI and app logic.

Notes

  • Only text-to-video is supported (no image+prompt).
  • All generated videos are visible to all users.

For more, see the code comments and docstrings in each file.