Spaces:
Runtime error
Runtime error
Update README.md
Browse files
README.md
CHANGED
|
@@ -11,4 +11,136 @@ license: mit
|
|
| 11 |
short_description: Text Style Transfer is a web application that transforms inp
|
| 12 |
---
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 11 |
short_description: Text Style Transfer is a web application that transforms inp
|
| 12 |
---
|
| 13 |
|
| 14 |
+
Text Style Transfer
|
| 15 |
+
Overview
|
| 16 |
+
|
| 17 |
+
**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.**
|
| 18 |
+
|
| 19 |
+
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.
|
| 20 |
+
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
**Features**
|
| 24 |
+
|
| 25 |
+
Gen Z Slang Conversion β Convert plain text into modern Gen Zβstyle language with slang and emojis.
|
| 26 |
+
|
| 27 |
+
Formal Style Conversion β Transform informal text into clear, professional language.
|
| 28 |
+
|
| 29 |
+
Interactive Web Interface β Built with Gradio for real-time transformation.
|
| 30 |
+
|
| 31 |
+
AI-Powered Models β Context-aware style transfer using transformer-based models.
|
| 32 |
+
|
| 33 |
+
Flexible Deployment β Run locally or on Hugging Face Spaces.
|
| 34 |
+
|
| 35 |
+
----
|
| 36 |
+
|
| 37 |
+
**Requirements**
|
| 38 |
+
```
|
| 39 |
+
Python 3.8+
|
| 40 |
+
```
|
| 41 |
+
Virtual environment recommended
|
| 42 |
+
|
| 43 |
+
Installation
|
| 44 |
+
|
| 45 |
+
Clone the repository:
|
| 46 |
+
```
|
| 47 |
+
git clone https://github.com/Sunaina792/text_style_transfer.git
|
| 48 |
+
cd text_style_transfer
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
Create and activate a virtual environment:
|
| 52 |
+
```
|
| 53 |
+
python -m venv .venv
|
| 54 |
+
```
|
| 55 |
+
# Windows
|
| 56 |
+
```
|
| 57 |
+
.venv\Scripts\activate
|
| 58 |
+
```
|
| 59 |
+
# macOS/Linux
|
| 60 |
+
```
|
| 61 |
+
source .venv/bin/activate
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
# Install dependencies:
|
| 65 |
+
```
|
| 66 |
+
pip install -r requirements.txt
|
| 67 |
+
```
|
| 68 |
+
Usage
|
| 69 |
+
|
| 70 |
+
Run the application:
|
| 71 |
+
```
|
| 72 |
+
python app.py
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
Open the local URL (default: http://127.0.0.1:7860) in your browser.
|
| 76 |
+
|
| 77 |
+
Steps:
|
| 78 |
+
|
| 79 |
+
Enter text in the input field.
|
| 80 |
+
|
| 81 |
+
Select target style: **Gen Z** or **Formal.**
|
| 82 |
+
|
| 83 |
+
Click Transform to see the output instantly.
|
| 84 |
+
|
| 85 |
+
# Examples
|
| 86 |
+
```
|
| 87 |
+
Input Gen Z Formal
|
| 88 |
+
Hello, how are you? For fun, how are you? π Hello, how are you doing?
|
| 89 |
+
What's up? What's popping? π₯ How are you?
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
# Custom Models
|
| 93 |
+
|
| 94 |
+
RNN and LSTM architectures trained on custom datasets.
|
| 95 |
+
|
| 96 |
+
Compare traditional sequence-based models with transformers.
|
| 97 |
+
|
| 98 |
+
Training experiments are documented in Jupyter notebooks.
|
| 99 |
+
|
| 100 |
+
Models Used
|
| 101 |
+
|
| 102 |
+
Gen Z Slang Model: jusshini/genz_slang_model (T5 fine-tuned)
|
| 103 |
+
|
| 104 |
+
Formal Style Model: rajistics/informal_formal_style_transfer (T5 fine-tuned)
|
| 105 |
+
|
| 106 |
+
Models are automatically downloaded from Hugging Face during the first run.
|
| 107 |
+
|
| 108 |
+
# Project Structure
|
| 109 |
+
```
|
| 110 |
+
text_style_transfer/
|
| 111 |
+
βββ app.py # Gradio app
|
| 112 |
+
βββ models/
|
| 113 |
+
β βββ genz_model.py # Gen Z style logic
|
| 114 |
+
β βββ formal_model.py # Formal style logic
|
| 115 |
+
βββ notebooks/
|
| 116 |
+
β βββ normal_to_genz.ipynb
|
| 117 |
+
β βββ normal_to_formal.ipynb
|
| 118 |
+
βββ requirements.txt # Dependencies
|
| 119 |
+
βββ README.md
|
| 120 |
+
```
|
| 121 |
+
# Customization
|
| 122 |
+
|
| 123 |
+
Models: Modify models/genz_model.py or models/formal_model.py
|
| 124 |
+
|
| 125 |
+
UI: Update app.py for layout, themes, or examples
|
| 126 |
+
|
| 127 |
+
Training: Use notebooks to fine-tune models
|
| 128 |
+
|
| 129 |
+
# Contributing
|
| 130 |
+
|
| 131 |
+
Fork the repo
|
| 132 |
+
|
| 133 |
+
Create a feature branch: ```git checkout -b feature-name```
|
| 134 |
+
|
| 135 |
+
Commit your changes: ```git commit -m "Add new feature"```
|
| 136 |
+
|
| 137 |
+
Push and open a pull request
|
| 138 |
+
|
| 139 |
+
License
|
| 140 |
+
|
| 141 |
+
MIT License β see LICENSE file for details.
|
| 142 |
+
|
| 143 |
+
Author
|
| 144 |
+
|
| 145 |
+
Sunaina
|
| 146 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|