from transformers import pipeline # Load the Hugging Face pipeline for text generation pipe = pipeline("text-generation", model="meta-llama/Llama-3.2-1B") def generate_content(topic: str): """Generate AI content using Hugging Face pipeline.""" prompt = f"Create a detailed and engaging YouTube script about: {topic}" # Generate content generated_text = generator(prompt, max_length=500, num_return_sequences=1, temperature=0.7, top_p=0.9) # Extract the generated text (it's a list of dicts) return generated_text[0]['generated_text']