Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Hbernet/sora2-web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sora 2 Web - AI Video Generator 🎬

License: MIT Python Streamlit


📖 Table of Contents / 目录


English

Description

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.

Features ✨

  • 🎬 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

Requirements 🛠️

  • Python 3.10 or higher
  • Sora 2 API key (Get it here)
  • Windows/MacOS/Linux
  • At least 4GB of RAM
  • Internet connection

Installation

  1. Clone the repository:

    git clone https://github.com/Hbernet/sora2-web.git
    cd sora2-web
  2. Install dependencies:

    pip install -r requirements.txt
  3. Set up environment variables:

    Create a .env file in the project root:

    # Windows
    copy .env.example .env
    
    # Linux/Mac
    cp .env.example .env

    Edit .env and add your API key:

    API_KEY=your_api_key_here
    # Optional: Custom API base URL
    # API_BASE_URL=https://api.example.com/v1

Usage

  1. Start the application:

    python main.py
  2. Access the web interface:

    The application will automatically open in your default browser at http://localhost:8501

  3. 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"
  4. Download videos:

    Once generation is complete, preview and download your video directly from the interface.

Project Structure

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

Configuration

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)

Troubleshooting

Issue: API key not found

  • Make sure you've created a .env file in the project root
  • Verify that API_KEY=your_key is correctly set in the .env file

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

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

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 内存
  • 网络连接

安装步骤

  1. 克隆仓库:

    git clone https://github.com/Hbernet/sora2-web.git
    cd sora2-web
  2. 安装依赖:

    pip install -r requirements.txt
  3. 配置环境变量:

    在项目根目录创建 .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

使用方法

  1. 启动应用程序:

    python main.py
  2. 访问 Web 界面:

    应用程序会自动在默认浏览器中打开,地址为 http://localhost:8501

  3. 生成视频:

    文本转视频:

    • 在文本框中输入视频描述
    • 设置时长(1-15 秒)
    • 设置分辨率(例如:1280x720)
    • 点击"生成视频"

    图片转视频:

    • 上传一张图片(PNG、JPG、JPEG)
    • 输入视频描述
    • 设置时长和分辨率
    • 点击"生成视频"
  4. 下载视频:

    生成完成后,可以直接在界面中预览和下载视频。

项目结构

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages