INNER CODE UNIT · Python

generate_script

roboflow/awesome-openai-vision-api-experiments · experiments/gpt4v-narration/app.py:36

def generate_script(frames):
    prompt_messages = [
        {
            "role": "user",
            "content": [
                "These are frames of a video recorded from a person's point of view going through mundane life tasks. Create a short voiceover script in the style of a super excited sports narrator...",
                *map(lambda x: {"image": x, "resize": 768}, frames[0::10]),
            ],
        },
    ]
    result = client.chat.completions.create(
        model="gpt-4-vision-preview",
        messages=prompt_messages,
        max_tokens=500,
    )
    return result.choices[0].message.content

def shorten_script(script):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…