콘텐츠로 이동

get_captions

Retrieve captions for a single video.


Overview

Retrieves all caption segments for a specific video.


Function Signature

def get_captions(
    feature_view: str,
    uuid: str,
    model: str,
    config: Optional[str] = None,
    timestamp: Optional[str] = None
) -> pd.DataFrame

Description

Retrieves all caption segments for a specific video.


Parameters

Parameter Type Default Description
uuid str required Unique identifier for the video
Example: "f2c99e03-8415-4926-bf3d-60ec8c2ddab4"
model str required Name of the model that generated the captions
Example: "gpt-4o", "vila-1.5"
config str or None None Path to the config file
If None, only data where config_source is actually None will be retrieved
timestamp str or None None Retrieve a version from a specific point in time (ISO format)
If None, the latest version is retrieved

Returns

Type: pd.DataFrame

Columns:

  • uuid (str): Unique identifier for the video
  • segment_id (str): Unique identifier for the segment
  • timestamp (datetime): Data creation timestamp
  • model (str): Name of the caption generation model
  • index (int): Segment order (starting from 0)
  • start (float): Segment start time (seconds)
  • end (float): Segment end time (seconds)
  • text (str): Caption text
  • config_source (str or None): Path to the config file

Examples

Retrieve Latest Version

# Retrieve latest GPT-4 results
captions = get_captions(
    feature_view='caption_summary',
    uuid='f2c99e03-8415-4926-bf3d-60ec8c2ddab4',
    model='gpt-4o'
)

# Print results
for idx, row in captions.iterrows():
    print(f"[{row['start']:.1f}s - {row['end']:.1f}s] {row['text']}")

Output:

[0.0s - 10.0s] A man is standing in a kitchen...
[10.0s - 20.0s] The man places vegetables into a pan
[20.0s - 30.0s] He adds ingredients to the pot
...


Retrieve Version from Specific Timestamp

# Retrieve GPT-4 results as of 2024-12-01
captions = get_captions(
    feature_view='caption_summary',
    uuid='f2c99e03-8415-4926-bf3d-60ec8c2ddab4',
    model='gpt-4o',
    timestamp='2024-12-01T10:00:00'
)

Retrieve Results Using Specific Config

# Retrieve VILA + config_X.yaml results
captions = get_captions(
    feature_view='caption_summary',
    uuid='1d0f4f13-f79b-448b-b176-cbcc4f38e911',
    model='vila-1.5',
    config='config_X.yaml'
)