Spaces:
Sleeping
Sleeping
Download src/ClipForge.Workers/Jobs/FullPipelineJob.cs from clipeforge/app: direct link, hf CLI and curl.
- Browser
- Download file 2.59 kB
-
https://huggingface.co/spaces/clipeforge/app/resolve/main/src/ClipForge.Workers/Jobs/FullPipelineJob.cs
- Command line
-
hf download hf://spaces/clipeforge/app/src/ClipForge.Workers/Jobs/FullPipelineJob.cs
-
curl -L -o FullPipelineJob.cs https://huggingface.co/spaces/clipeforge/app/resolve/main/src/ClipForge.Workers/Jobs/FullPipelineJob.cs
2.59 kB
| using ClipForge.Core.Interfaces.Services; | |
| using Microsoft.Extensions.Logging; | |
| namespace ClipForge.Workers.Jobs; | |
| public class FullPipelineJob | |
| { | |
| private readonly IIdeaGenerationService _ideaService; | |
| private readonly IScriptGenerationService _scriptService; | |
| private readonly IVoiceGenerationService _voiceService; | |
| private readonly IVideoAssemblyService _assemblyService; | |
| private readonly ILogger<FullPipelineJob> _logger; | |
| public FullPipelineJob( | |
| IIdeaGenerationService ideaService, | |
| IScriptGenerationService scriptService, | |
| IVoiceGenerationService voiceService, | |
| IVideoAssemblyService assemblyService, | |
| ILogger<FullPipelineJob> logger) | |
| { | |
| _ideaService = ideaService; | |
| _scriptService = scriptService; | |
| _voiceService = voiceService; | |
| _assemblyService = assemblyService; | |
| _logger = logger; | |
| } | |
| public async Task ExecuteAsync(string niche, string platform = "tiktok", string voiceId = "alloy") | |
| { | |
| _logger.LogInformation("Starting full pipeline for niche '{Niche}' on {Platform}", niche, platform); | |
| try | |
| { | |
| // Step 1: Generate idea | |
| _logger.LogInformation("Step 1: Generating idea..."); | |
| var idea = await _ideaService.GenerateIdeaAsync(niche, platform); | |
| _logger.LogInformation("Idea generated: {Title}", idea.Title); | |
| // Step 2: Generate script | |
| _logger.LogInformation("Step 2: Generating script..."); | |
| var script = await _scriptService.GenerateScriptAsync(idea.Id); | |
| _logger.LogInformation("Script generated, duration: {Duration}s", script.EstimatedDurationSeconds); | |
| // Step 3: Generate voice | |
| _logger.LogInformation("Step 3: Generating voice..."); | |
| var voice = await _voiceService.GenerateVoiceAsync(script.Id, voiceId); | |
| _logger.LogInformation("Voice generated: {Duration}s", voice.DurationSeconds); | |
| // Step 4: Assemble video (includes subtitles) | |
| _logger.LogInformation("Step 4: Assembling video..."); | |
| var video = await _assemblyService.AssembleVideoAsync(script.Id); | |
| _logger.LogInformation("Video assembled: {FilePath}, size: {Size}MB", video.FilePath, video.FileSizeBytes / 1024.0 / 1024.0); | |
| _logger.LogInformation("Full pipeline completed successfully for niche '{Niche}'", niche); | |
| } | |
| catch (Exception ex) | |
| { | |
| _logger.LogError(ex, "Full pipeline failed for niche '{Niche}'", niche); | |
| throw; | |
| } | |
| } | |
| } | |