File size: 505 Bytes
d5c679f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from llama_cpp import Llama


def get_llm(model_path: str = "models/Meta-Llama-3.1-8B-Instruct-IQ4_XS.gguf") -> Llama:
    return Llama(
        model_path=model_path,
        n_gpu_layers=-1,
    )


def summarize_transcript(llm: Llama, transcript: str) -> str:
    summary = llm.create_chat_completion(
        messages=[
            {
                "role": "user",
                "content": f"Summarize the following video transcript: {transcript}",
            }
        ]
    )
    return summary