File size: 4,587 Bytes
ea99f78
 
 
 
 
 
 
 
 
 
83b70fe
 
 
 
 
 
b38a0da
83b70fe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b38a0da
061308f
 
 
 
 
 
b38a0da
 
 
 
 
 
 
 
 
 
 
061308f
 
 
 
 
 
b38a0da
061308f
 
 
 
 
 
 
 
 
 
 
 
 
b38a0da
061308f
 
 
 
 
b38a0da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
061308f
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
103
104
105
---

title: Text Rewrite with LangChain
emoji: 😎
colorFrom: green
colorTo: blue
sdk: streamlit
app_file: app.py
pinned: false
---


# ReWriteCraft: Text Rewrite with Custom Tone and Dialect 🎨
## Introduction
Welcome to **ReWriteCraft**! πŸŽ‰ This project allows you to rewrite your text in a customized tone and dialect using the **LLama 3.1** model. The app provides an intuitive interface to input your draft text and apply different tones (Formal/Informal) and dialects (American/British).

This app leverages LangChain and Ollama models to enhance the AI's rewriting capabilities. Whether you want to refine the tone of a formal letter or add a casual touch to your writing, this app has you covered! πŸ“


## Project Structure
The project is organized as follows:
```

ReWriteCraft/

β”‚

β”œβ”€β”€ app.py                # Main Streamlit application file

β”œβ”€β”€ requirements.txt      # Python dependencies for the project

β”œβ”€β”€ LICENSE               # License file (GNU)

β”œβ”€β”€ README.md             # Project documentation

β”‚

β”œβ”€β”€ assets/               # Folder containing output examples for tone and dialect conversion

β”‚   β”œβ”€β”€ FormaltoInformal/ # Folder with examples of text converted from formal to informal tone

β”‚   └── InformaltoFormal/ # Folder with examples of text converted from informal to formal tone

```


## Features
* **Customizable Tone**: Choose between Formal or Informal tones for your rewritten text.
* **Customizable Dialect**: Choose between American or British dialects.
* **Easy-to-use Interface**: The app is built using Streamlit, making it interactive and simple.
* **Quick Response**: Rewritten text is generated with the help of the LLama 3.1 model.


## Prerequisites
Before running the project, ensure the following requirements are met:
1. **Install Ollama**: Ollama is the platform required to run the LLama 3.1 model. Follow the instructions on the Ollama official website to download and install it on your device.
2. **Download LLama 3.1 Model**: After installing Ollama, download the LLama 3.1 model by running the following command in your terminal:
```

ollama pull llama3.1

```
3. **Python Environment**: Ensure you have Python installed on your machine. It's recommended to use Python 3.9 or later for compatibility with the dependencies listed in `requirements.txt`.


## How to Use
1. **Clone the Repository**: Clone this repository to your local machine or server:
```

git clone https://github.com/iSathyam31/ReWriteCraft.git

cd ReWriteCraft

```
2. **Create a `.env` file**: In the root directory, create a `.env` file to store your LangChain API key:
```

LANGCHAIN_API_KEY=your_api_key_here

```
3. **Install Dependencies**: Install the required Python packages listed in the `requirements.txt`:
```

pip install -r requirements.txt

```
4. **Run the App**: Once the dependencies are installed, you can run the Streamlit app using:
```

streamlit run app.py

```
The app will be accessible in your browser at `http://localhost:8501`.


## Project Constraints
* **Word Limit**: The app currently supports a maximum of 1500 words for input. You can modify this limit in the code if needed. The input text must be within this word count to avoid performance issues.
* **Tone & Dialect Selection**:
  - The options for tone (Formal/Informal) and dialect (American/British) are optional. You can choose one or both options based on your needs.
  - If you want a specific tone or dialect applied to your text, simply check the corresponding boxes. You can apply both tone and dialect together or choose either one independently.
  - This flexibility allows you to get a variety of outputs depending on your selection.  


## Requirements
You can find the necessary dependencies in the `requirements.txt` file. Here is the list:
```

ipykernel

langchain==0.2.10

langchain_community==0.2.10

langchain-openai==0.1.17

langchain-groq==0.1.6

langchain-ollama==0.1.0

python-dotenv==1.0.1

streamlit

```


## License
This project is licensed under the GNU General Public License v3.0. See the LICENSE file for more information.


## Acknowledgements
* **LangChain**: Used for integrating LLMs and text processing functionalities.
* **Ollama**: The primary language model used in this project (LLama 3.1) for text generation.
* **Streamlit**: The framework used to build this interactive web app.

Thanks to all the developers and contributors of these tools for making them available to the open-source community! πŸ™Œ