Sunaina792/text-style-transfer
Text Style Transfer Overview
Text Style Transfer is a web application that transforms input text into different linguistic styles while preserving its meaning. Users can convert text into Gen Z slang or formal, professional language through an intuitive Gradio interface.
The system leverages pre-trained transformer models from Hugging Face and includes experiments with custom RNN and LSTM models, providing a comparative study of traditional and modern NLP approaches.
Features
Gen Z Slang Conversion – Convert plain text into modern Gen Z–style language with slang and emojis.
Formal Style Conversion – Transform informal text into clear, professional language.
Interactive Web Interface – Built with Gradio for real-time transformation.
AI-Powered Models – Context-aware style transfer using transformer-based models.
Flexible Deployment – Run locally or on Hugging Face Spaces.
Requirements
Python 3.8+Virtual environment recommended
Installation
Clone the repository:
git clone https://github.com/Sunaina792/text_style_transfer.git
cd text_style_transferCreate and activate a virtual environment:
python -m venv .venvWindows
.venv\Scripts\activatemacOS/Linux
source .venv/bin/activateInstall dependencies:
pip install -r requirements.txtUsage
Run the application:
python app.pyOpen the local URL (default: http://127.0.0.1:7860) in your browser.
Steps:
Enter text in the input field.
Select target style: Gen Z or Formal.
Click Transform to see the output instantly.
Examples
Input Gen Z Formal
Hello, how are you? For fun, how are you? 😎 Hello, how are you doing?
What's up? What's popping? 🔥 How are you?Custom Models
RNN and LSTM architectures trained on custom datasets.
Compare traditional sequence-based models with transformers.
Training experiments are documented in Jupyter notebooks.
Models Used
Gen Z Slang Model: jusshini/genzslangmodel (T5 fine-tuned)
Formal Style Model: rajistics/informalformalstyle_transfer (T5 fine-tuned)
Models are automatically downloaded from Hugging Face during the first run.
Project Structure
text_style_transfer/
├── app.py # Gradio app
├── models/
│ ├── genz_model.py # Gen Z style logic
│ └── formal_model.py # Formal style logic
├── notebooks/
│ ├── normal_to_genz.ipynb
│ └── normal_to_formal.ipynb
├── requirements.txt # Dependencies
└── README.mdCustomization
Models: Modify models/genzmodel.py or models/formalmodel.py
UI: Update app.py for layout, themes, or examples
Training: Use notebooks to fine-tune models
Contributing
Fork the repo
Create a feature branch: ``git checkout -b feature-name``
Commit your changes: ``git commit -m "Add new feature"``
Push and open a pull request
License
MIT License – see LICENSE file for details.
Author
Sunaina Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
