DEV Community

shauryamalhotra957-wq
shauryamalhotra957-wq

Posted on

GhostWriter AI: Building a Local AI Horror Story Generator 👻

Hacktoberfest Open-Source AI Challenge: Ghost in the Machine Submission 👻🌼

GhostWriter AI: A Local AI Horror Story Generator 👻

What if you could summon a horror story directly from your terminal, powered by an open-weight AI model running on your own machine?

That's the idea behind GhostWriter AI, a command-line horror story generator I built for the Hacktoberfest 2026 Week 4 challenge: Ghost in the Machine.

👻 What is GhostWriter AI?

GhostWriter AI is a Python-based terminal application that generates horror stories from user-provided prompts.

It uses DistilGPT-2, an open-weight language model, through PyTorch and the Hugging Face ecosystem.

Instead of sending every prompt to a hosted AI API, the application loads the model locally and generates text on the user's machine.

⚙️ Features

  • Local AI inference using DistilGPT-2.
  • Six horror genres:
    • Supernatural
    • Psychological Horror
    • Paranormal
    • Cosmic Horror
    • Gothic Horror
    • Sci-Fi Horror
  • Three story lengths: short, medium, and long.
  • Custom prompts to guide story generation.
  • Save generated stories locally as text files.
  • Terminal interface with a horror-inspired design.

🧠 How does it work?

The application follows a simple pipeline:

  1. The user enters a story prompt.
  2. The user selects a horror genre.
  3. The user chooses the desired story length.
  4. The local language model generates text.
  5. The generated story can be saved to the local stories directory.

The project uses Python, PyTorch, and DistilGPT-2.

🔓 Why open-source AI?

For me, the most interesting part of this project is being able to run an AI model locally.

Open-weight models make experimentation more accessible. They let developers explore inference, modify generation settings, and build applications without depending entirely on a paid hosted API.

Local inference can also help keep prompts on the user's own machine after the model has been downloaded.

This makes GhostWriter AI a small experiment in building AI-powered applications with open technology.

🖥️ Try it yourself

GitHub repository:

https://github.com/shauryamalhotra957-wq/ghostwriter-ai

Clone the repository:

git clone https://github.com/shauryamalhotra957-wq/ghostwriter-ai.git
cd ghostwriter-ai
Enter fullscreen mode Exit fullscreen mode

Install dependencies:

pip install -r requirements.txt
Enter fullscreen mode Exit fullscreen mode

Run the application:

python main.py
Enter fullscreen mode Exit fullscreen mode

The model weights may need to be downloaded the first time you run the application.

🛠️ Built with

  • Python
  • PyTorch
  • DistilGPT-2
  • Hugging Face Transformers

🚧 What's next?

GhostWriter AI is an early prototype. Story coherence and prompt adherence are areas I want to improve.

Future plans include experimenting with better open-weight models, improving generation controls, and building a more polished interface.

Final thoughts

This project helped me explore how open-weight language models can be integrated into a practical application.

The goal was simple: build a little horror machine that lives in your terminal.

And perhaps, give it a few nightmares of its own.

Built for Hacktoberfest 2026 — Week 4: Ghost in the Machine.

devchallenge #hf26challenge #hacktoberfest #ai #python #opensource

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine.This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine

What I Built

Demo

Code

How I Built It

Why Does Open Innovation Matter?

My Agent Session

The Spirit of It

Prize Categories

Top comments (0)