-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add Sora video generation sample #163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
DETAILS - Updated solution to include "11 Video Generation" and "VideoGeneration-AzureSora-01" projects. - Modified `Program.cs` to implement video generation functionality with Azure's OpenAI service, including configuration loading, job creation, status polling, and video downloading. - Created `VideoGeneration-AzureSora-01.csproj` targeting .NET 9.0 with user secrets management.
👋 Thanks for contributing @elbruno! We will review the pull request and get back to you soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new Azure OpenAI Sora video generation sample project to the course and updates documentation to surface the new demo.
- Introduces a new
VideoGeneration-AzureSora-01
project (net9.0) in the solution, with user secrets and sample code. - Implements end-to-end video generation (job creation, polling, download) in
Program.cs
. - Updates
README.md
and10-WhatsNew/readme.md
to highlight the Sora video generation demo.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
README.md | Added Sora video generation demo to main README |
10-WhatsNew/readme.md | Documented June 2025 entry for Sora demo |
03-CoreGenerativeAITechniques/src/VideoGeneration-AzureSora-01/VideoGeneration-AzureSora-01.csproj | New project file for the video generation sample |
03-CoreGenerativeAITechniques/src/VideoGeneration-AzureSora-01/Program.cs | Implemented Sora video generation workflow |
03-CoreGenerativeAITechniques/src/CoreGenerativeAITechniques.sln | Added solution folder and project references |
Comments suppressed due to low confidence (1)
10-WhatsNew/readme.md:9
- [nitpick] The heading omits 'OpenAI' and 'Demo' compared to the main README; consider aligning it to 'Azure OpenAI Sora Video Generation Demo' for consistency.
- **New Lesson 3 Sample: Azure Sora Video Generation**
|
||
string idx = DateTime.Now.ToString("ddMMMyyyy_HHmmss"); | ||
string suffix = new string(prompt.Length > 30 ? prompt.Substring(0, 30).ToCharArray() : prompt.ToCharArray()); | ||
suffix = suffix.Replace(",", "_").Replace(".", "_").Replace(" ", "_"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only replacing commas, periods, and spaces may leave other invalid filename characters. Consider sanitizing suffix
using Path.GetInvalidFileNameChars()
or a regex to remove all invalid characters.
suffix = suffix.Replace(",", "_").Replace(".", "_").Replace(" ", "_"); | |
var invalidChars = Path.GetInvalidFileNameChars(); | |
suffix = new string(suffix.Select(c => invalidChars.Contains(c) ? '_' : c).ToArray()); |
Copilot uses AI. Check for mistakes.
do | ||
{ | ||
await Task.Delay(5000); | ||
var statusResp = await client.GetAsync(statusUrl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider calling statusResp.EnsureSuccessStatusCode()
after the GET request to immediately handle HTTP errors rather than parsing potentially invalid JSON.
var statusResp = await client.GetAsync(statusUrl); | |
var statusResp = await client.GetAsync(statusUrl); | |
statusResp.EnsureSuccessStatusCode(); |
Copilot uses AI. Check for mistakes.
var client = new HttpClient(); | ||
client.DefaultRequestHeaders.Add("api-key", apiKey); | ||
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creating a new HttpClient
instance per request can lead to socket exhaustion; consider reusing a single HttpClient
instance or using IHttpClientFactory
.
var client = new HttpClient(); | |
client.DefaultRequestHeaders.Add("api-key", apiKey); | |
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); | |
var client = httpClient; // Reuse the top-level HttpClient instance |
Copilot uses AI. Check for mistakes.
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="6.0.1" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The UserSecrets
package version 6.0.1
may not align with the project's .NET 9.0 target; consider updating to a version compatible with .NET 9 or relying on built-in secrets support.
Copilot uses AI. Check for mistakes.
Check Broken URLsWe have automatically detected the following broken URLs in your files. Review and fix the paths to resolve this issue. Check the file paths and associated broken URLs inside them.
|
This pull request introduces a new feature for video generation using the Azure OpenAI Sora model and updates relevant documentation and project files. The changes include adding a new lesson sample, implementing the video generation functionality, and updating the course materials to reflect the new capabilities.
New feature: Azure OpenAI Sora Video Generation
Project and functionality updates:
VideoGeneration-AzureSora-01
, to the solution fileCoreGenerativeAITechniques.sln
. This includes the necessary configurations for building and debugging the video generation demo. [1] [2] [3]Program.cs
, which allows users to generate videos from text prompts using the Azure OpenAI Sora model. The implementation includes job creation, polling for status, and downloading the generated video..csproj
file forVideoGeneration-AzureSora-01
with configurations for .NET 9.0, user secrets, and necessary dependencies.Documentation updates:
README.md
to highlight the new Azure OpenAI Sora Video Generation demo, including a description of its features and links to the sample code and official documentation.10-WhatsNew/readme.md
to include details about the new Sora video generation demo in Lesson 3, along with instructions and links for further exploration.These changes provide users with a hands-on example of generating videos using text prompts, enhancing the course's generative AI capabilities.