Skip to content

Instantly share code, notes, and snippets.

@JessicaWachtel
Created November 28, 2025 15:17
Show Gist options
  • Select an option

  • Save JessicaWachtel/b9337dd7fd09c1e648dc7fa88e202b3b to your computer and use it in GitHub Desktop.

Select an option

Save JessicaWachtel/b9337dd7fd09c1e648dc7fa88e202b3b to your computer and use it in GitHub Desktop.
generator = pipeline("text-generation", model="gpt2")
prompt = "Explain how self-driving cars work in simple terms."
result = generator(prompt, max_length=50, num_return_sequences=1)
print("=== Text Generation ===")
print(result[0]['generated_text'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment