The AI Story Generator is a deep learning-based project that generates creative stories based on writing prompts. This project leverages NLP techniques and a custom CNN-LSTM deep learning model to generate coherent and engaging narratives.
- Preprocessing: Cleans and tokenizes input data from a dataset.
- Training: Uses a CNN-LSTM neural network model to learn from story prompts.
- Generation: Produces unique and engaging stories based on input prompts.
- Evaluation: Assesses the model's performance using metrics like accuracy and F1-score.
- Deployment: Provides a simple web UI using Streamlit for easy interaction.
The project uses the WritingPrompts dataset, stored in data/writingPrompts/. The dataset consists of writing prompts and their corresponding stories. The preprocessing script converts the dataset into CSV format, which is then used for model training. You can enhance the model's performance by adding more prompts.
📁 Story_Generator
│── 📁 data
│ └── 📁 writingPrompts # Raw dataset files
│ └── 📁 csv
│ ├── train.csv # Training data
│ ├── valid.csv # Validation data
│ ├── test.csv # Test data
│── 📁 models
│ ├── story_generator.h5 # Trained model
│ ├── tokenizer.pkl # Tokenizer for text processing
│── 📁 src
│ ├── preprocess.py # Convert dataset to CSV format
│ ├── train.py # Train the CNN-LSTM model
│ ├── build_model.py # Defines the CNN-LSTM architecture
│ ├── generate.py # Story generation script
│ ├── evaluate.py # Model evaluation script
│── 📁 deployment
│ ├── app.py # Streamlit web UI for text generation
│── requirements.txt # List of dependencies
│── README.md # Project documentation
- Clone the repository:
git clone https://github.com/Vamshi-27/SIC_Project.git cd SIC_Project - Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
Convert the raw dataset into CSV format:
python src/preprocess.pyTrain the CNN-LSTM model using the processed dataset:
python src/train.pyGenerate a new story based on a writing prompt:
python src/generate.py --prompt "Once upon a time..."Evaluate the trained model on test data:
python src/evaluate.pyRun the Streamlit web app:
streamlit run deployment/app.pyEnsure you have all required Python packages installed by referring to requirements.txt. The project mainly uses:
- TensorFlow/Keras
- NLTK
- Pandas
- NumPy
- Streamlit
- Improve model accuracy with advanced NLP techniques.
- Introduce a feedback mechanism to refine generated stories.
- Deploy as a web application with user authentication.
- Explore integration with voice input for interactive storytelling.