File size: 579 Bytes
c711ee4 f8c10ae c711ee4 4d409f3 c711ee4 c9d9274 c711ee4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
from transformers import pipeline
# Load the Hugging Face pipeline for text generation
generator = pipeline("text-generation", model="Qwen/Qwen2.5-1.5B-Instruct")
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=2000, 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']
|