Spaces:
Running
Running
File size: 3,910 Bytes
d8fff79 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# StoryCraftAI
[](https://github.com/amitsingh-24/StoryCraftAI/blob/main/.github/workflows/deploy.yml)
[](https://huggingface.co/spaces/asr24/StoryCraftAI)
Learn how to automate story generation using deep learning and deploy a full-featured web application with CI/CD.
## Project Description
**StoryCraftAI** is an automatic story generation system built entirely from scratch using deep learning. This project covers the entire pipeline—from scraping and preprocessing classic short stories to training various neural network architectures and generating creative narratives from a user-provided seed text.
### Key Features
- **Data Scraping & Preprocessing:**
- Automatically scrapes classic short stories from [classicshorts.com](http://www.classicshorts.com/).
- Cleans text by removing unwanted characters and tokenizes sentences into words.
- **Multiple Model Architectures:**
- **GRU & LSTM:** Optimized for sequence prediction.
- **Bidirectional Models:** (Bidirectional-LSTM and Bidirectional-GRU) Capture richer context.
- **Hybrid Approaches:** Combine strengths of different models for better performance.
- **Training & Evaluation:**
- Generates training sequences (50 words as input and 1 as output).
- Tracks performance with accuracy and loss metrics.
- Saves training history for visualization.
- **Interactive Web Application:**
- Flask-based web interface for real-time story generation.
- **CI/CD & Deployment:**
- Deployed on Hugging Face Spaces with continuous integration via GitHub Actions.
## Getting Started
### Prerequisites
- Python 3.8 or later.
- Virtual environment (recommended).
### Installation
1. Clone the repository:
```bash
git clone https://github.com/yourusername/StoryCraftAI.git
cd StoryCraftAI
```
2. Create and activate a virtual environment:
```bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```
3. Install dependencies:
```bash
pip install -r requirements.txt
```
4. Download NLTK data:
```bash
python -c "import nltk; nltk.download('punkt')"
```
5. Run the application locally:
```bash
python app.py
```
## Training the Models
### Pipeline Overview
- **Data Scraping:** Fetches stories from [classicshorts.com](http://www.classicshorts.com/).
- **Preprocessing:** Tokenizes text and creates sequences of 51 tokens (50 input, 1 target).
- **Model Building:** Supports architectures like `gru`, `lstm`, `bi_di_gru`, and `bi_di_lstm`.
- **Training:** Uses categorical crossentropy loss. Training logs and performance graphs are generated.
### Execution
Run the training scripts using Jupyter notebooks in the `Notebooks/` folder or directly from the command line. Save the trained model, tokenizer, and training history in the `Models/` directory.
## Deployment
### Using Docker
1. Build and run the Docker container locally:
```bash
docker build -t storycraftai .
docker run -p 7860:7860 storycraftai
```
### CI/CD on Hugging Face Spaces
- Configured for CI/CD using GitHub Actions. Every push to the `main` branch triggers an automated rebuild and redeployment.
## Contributing
Contributions are welcome! Please:
1. Fork the repository.
2. Create a new branch.
3. Submit a pull request detailing your modifications.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
## Contact
For questions or feedback:
- Email: imamitsingh958@gmail.com
- GitHub: [@amitsingh-24](https://github.com/amitsingh-24)
- Linkedin: [@Linkedin](https://www.linkedin.com/in/amit-singh-rajawat-4787a4213/)
Enjoy creating and exploring creative stories with **StoryCraftAI**!
|