Sora 2 Web is a user-friendly web application that simplifies the process of creating AI-generated videos using the Sora 2 API. Built with Streamlit, it provides an intuitive interface for both text-to-video and image-to-video generation.
- 🎬 Text-to-Video: Generate videos from text descriptions
- 🖼️ Image-to-Video: Transform static images into dynamic videos
- ⚙️ Easy Configuration: Simple setup with environment variables
- 📊 Real-time Progress: Monitor video generation progress
- 📥 Direct Download: Download generated videos instantly
- 🎨 Modern UI: Clean and intuitive web interface
- Python 3.10 or higher
- Sora 2 API key (Get it here)
- Windows/MacOS/Linux
- At least 4GB of RAM
- Internet connection
-
Clone the repository:
git clone https://github.com/Hbernet/sora2-web.git cd sora2-web -
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
Create a
.envfile in the project root:# Windows copy .env.example .env # Linux/Mac cp .env.example .env
Edit
.envand add your API key:API_KEY=your_api_key_here # Optional: Custom API base URL # API_BASE_URL=https://api.example.com/v1
-
Start the application:
python main.py
-
Access the web interface:
The application will automatically open in your default browser at
http://localhost:8501 -
Generate videos:
Text-to-Video:
- Enter your video description in the text area
- Set the duration (1-15 seconds)
- Set the resolution (e.g., 1280x720)
- Click "Generate Video"
Image-to-Video:
- Upload an image (PNG, JPG, JPEG)
- Enter your video description
- Set the duration and resolution
- Click "Generate Video"
-
Download videos:
Once generation is complete, preview and download your video directly from the interface.
sora2-web/
├── main.py # Main application file
├── requirements.txt # Python dependencies
├── README.md # This file
├── LICENSE # License file
├── .env # Environment variables (create this)
├── input/ # Uploaded images directory
└── output/ # Generated videos directory
You can customize the application by modifying the .env file:
API_KEY: Your Sora 2 API key (required)API_BASE_URL: Custom API endpoint (optional)
Issue: API key not found
- Make sure you've created a
.envfile in the project root - Verify that
API_KEY=your_keyis correctly set in the.envfile
Issue: Port already in use
- Streamlit uses port 8501 by default. If it's occupied, it will automatically try the next available port
Issue: Video generation fails
- Check your API key is valid and has sufficient credits
- Verify your internet connection
- Check the error message in the application for details
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Sora 2 Web 是一个基于 Streamlit 构建的 Web 应用程序,用于简化使用 Sora 2 API 创建 AI 生成视频的过程。它提供了直观的界面,支持文本到视频和图片到视频两种生成模式。
- 🎬 文本转视频: 根据文本描述生成视频
- 🖼️ 图片转视频: 将静态图片转换为动态视频
- ⚙️ 简单配置: 使用环境变量轻松设置
- 📊 实时进度: 监控视频生成进度
- 📥 直接下载: 即时下载生成的视频
- 🎨 现代界面: 简洁直观的 Web 界面
- Python 3.10 或更高版本
- Sora 2 API 密钥(在此获取)
- Windows/MacOS/Linux
- 至少 4GB 内存
- 网络连接
-
克隆仓库:
git clone https://github.com/Hbernet/sora2-web.git cd sora2-web -
安装依赖:
pip install -r requirements.txt
-
配置环境变量:
在项目根目录创建
.env文件:# Windows copy .env.example .env # Linux/Mac cp .env.example .env
编辑
.env文件并添加您的 API 密钥:API_KEY=your_api_key_here # 可选: 自定义 API 基础 URL # API_BASE_URL=https://api.example.com/v1
-
启动应用程序:
python main.py
-
访问 Web 界面:
应用程序会自动在默认浏览器中打开,地址为
http://localhost:8501 -
生成视频:
文本转视频:
- 在文本框中输入视频描述
- 设置时长(1-15 秒)
- 设置分辨率(例如:1280x720)
- 点击"生成视频"
图片转视频:
- 上传一张图片(PNG、JPG、JPEG)
- 输入视频描述
- 设置时长和分辨率
- 点击"生成视频"
-
下载视频:
生成完成后,可以直接在界面中预览和下载视频。
sora2-web/
├── main.py # 主应用程序文件
├── requirements.txt # Python 依赖包
├── README.md # 本文件
├── LICENSE # 许可证文件
├── .env # 环境变量文件(需创建)
├── input/ # 上传图片目录
└── output/ # 生成视频目录
您可以通过修改 .env 文件来自定义应用程序:
API_KEY: 您的 Sora 2 API 密钥(必需)API_BASE_URL: 自定义 API 端点(可选)
问题: 找不到 API 密钥
- 确保已在项目根目录创建
.env文件 - 验证
.env文件中API_KEY=your_key是否正确设置
问题: 端口已被占用
- Streamlit 默认使用 8501 端口。如果被占用,会自动尝试下一个可用端口
问题: 视频生成失败
- 检查您的 API 密钥是否有效且有足够的余额
- 验证网络连接
- 查看应用程序中的错误信息以获取详细信息
欢迎贡献!请随时提交 Pull Request。
本项目采用 MIT 许可证 - 详情请参阅 LICENSE 文件。
Made with ❤️ for the AI community