This project is a text generation web application that takes user input and generates text dynamically using a pre-trained language model (distilgpt2). It showcases the utilization of NLP (Natural Language Processing) models in an intuitive web interface, featuring a clean UI built with Bootstrap 4 and a Flask backend with Flask-SocketIO for real-time updates and communication.
- Text Generation: Generates text based on user input using the distilgpt2 model.
- Flask Backend: Serves the web app and handles API requests for text generation.
- SocketIO: Enables real-time communication between client and server.
- Bootstrap 4: Provides a responsive and modern UI for desktop and mobile views.
- Google Fonts & Material Icons: Enhances user experience with clean fonts and iconography.
- SVG Graphics: Includes scalable vector graphics for improved aesthetics.
- Backend: Python, Flask, Flask-SocketIO
- Frontend: HTML5, CSS3 (Bootstrap 4), JavaScript
- Machine Learning Model: HuggingFace
distilgpt2for natural language generation - Deployment: AWS S3 for hosting static files, Flask for backend server
- Others: Material Icons, Google Fonts, SVG graphics
-
Clone the repository:
git clone https://github.com/your-username/text-generation-webapp.git cd text-generation-webapp -
Make a Python virtual environment:
python -m venv myenv source myenv/bin/activate # On Windows: myenv\Scripts\activate
-
Install required dependencies:
pip install -r requirements.txt
-
Run the application:
python app.py
-
Open the application: Navigate to
http://127.0.0.1:5500/in your browser.
- Access the homepage with the text generation prompt.
- Enter a prompt in the input field.
- Click 'Generate' to process your input.
- Review the generated text displayed below the input field.
.
├── app.py # Main Flask app and backend API
├── templates
│ └── index.html # Frontend HTML with Bootstrap and JS
├── static
│ ├── style.css # Custom styling
│ └── FetchAPI.js # JavaScript for handling API calls
├── requirements.txt # Python dependencies
└── README.md # Project documentation
This project is licensed under the Apache-2.0 License.