You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
langchain/libs/experimental/langchain_experimental/video_captioning/services/srt_service.py

15 lines
459 B
Python

from typing import List
from langchain_experimental.video_captioning.models import CaptionModel
class SRTProcessor:
@staticmethod
def process(caption_models: List[CaptionModel]) -> str:
"""Generates the full SRT content from a list of caption models."""
srt_entries = []
for index, model in enumerate(caption_models, start=1):
srt_entries.append(model.to_srt_entry(index))
return "\n".join(srt_entries)