This project is a web application that uses a custom-built Transformer model, trained from scratch, to generate text in the style of the Russian novelist Fyodor Dostoevsky. The backend is a Flask API that serves the trained model, and the frontend is a simple HTML/CSS/JS interface that allows users to interact with it.
To run this project locally, follow these steps:
git clone [https://github.com/AshishRaj04/dostoevsky-generator.git](https://github.com/AshishRaj04/dostoevsky-generator.git) cd dostoevsky-generator
python -m venv venv
# On Windows venv\Scripts\activate # On macOS/Linux source venv/bin/activate
# Install all the required Python packages using the requirements.txt file. pip install -r requirements.txt
The trained model weights and tokenizer file are provided in the /checkpoints and /engine directories respectivelly.
# Start the backend server by running app.py. python app.py
The API will now be running at http://localhost:8000.
Simply open the index.html file in your web browser to interact with the application.
API Endpoint
The application exposes a single API endpoint for text generation.
URL: /api/generate
Method: POST
Description: Triggers the model to generate a new text sample.
Success Response (200): { "status": "success", "generated_text": "..." } Error Response (500): { "status": "error", "message": "Error description..." }