├── README.md ├── app.py ├── examples.txt ├── images └── ChatGPT-Prompt-Gen.png └── requirements.txt /README.md: -------------------------------------------------------------------------------- 1 | 2 | # ChatGPT-BingChat Prompt Generator 3 | 4 | Generates ChatGPT/BingChat & GPT-3 prompts using [this](https://huggingface.co/Kaludi/chatgpt-gpt4-prompts-bart-large-cnn-samsum) model trained by [Kaludi](https://huggingface.co/Kaludi). 5 | 6 | Enter a role and a prompt will be generated based on it. 7 | 8 | # Web App 9 | Click [Here](https://huggingface.co/spaces/Kaludi/ChatGPT-BingChat-GPT3-Prompt-Generator_App "Here") To View This App Online! 10 | 11 |  12 | 13 | ## Features 14 | 15 | - Generate prompts based on a role entered by the user 16 | - Uses a pre-trained language model to generate the prompt 17 | 18 | ## Usage 19 | 20 | To use the app, simply enter a role in the input field and click on the "Generate" button. A prompt will be generated based on the role entered. 21 | 22 | ## Examples 23 | 24 | Some examples of roles that can be entered: 25 | 26 | - Virtual Assistant 27 | - Customer Service Representative 28 | - Personal Assistant 29 | - Data Scientist 30 | 31 | ## Technical details 32 | 33 | The app uses Streamlit for the user interface and the Hugging Face Transformers and is a fine-tuned version of [philschmid/bart-large-cnn-samsum's](https://huggingface.co/philschmid/bart-large-cnn-samsum) model using [this](https://huggingface.co/datasets/fka/awesome-chatgpt-prompts) dataset. 34 | 35 | It achieves the following results on the evaluation set: 36 | - Train Loss: 1.2214 37 | - Validation Loss: 2.7584 38 | - Epoch: 4 39 | 40 | ### Training hyperparameters 41 | 42 | The following hyperparameters were used during training: 43 | - optimizer: {'name': 'AdamWeightDecay', 'learning_rate': 2e-05, 'decay': 0.0, 'beta_1': 0.9, 'beta_2': 0.999, 'epsilon': 1e-07, 'amsgrad': False, 'weight_decay_rate': 0.01} 44 | - training_precision: float32 45 | 46 | ### Training results 47 | 48 | | Train Loss | Validation Loss | Epoch | 49 | |:----------:|:---------------:|:-----:| 50 | | 3.1982 | 2.6801 | 0 | 51 | | 2.3601 | 2.5493 | 1 | 52 | | 1.9225 | 2.5377 | 2 | 53 | | 1.5465 | 2.6794 | 3 | 54 | | 1.2214 | 2.7584 | 4 | 55 | 56 | ## Requirements 57 | 58 | - Python 3.6 or higher 59 | - Streamlit 60 | - Transformers (Hugging Face) 61 | 62 | ## Installation 63 | 64 | 1. Clone the repository: 65 | 66 | `git clone https://github.com/Kaludii/ChatGPT-BingChat-GPT3-Prompt-Generator.git` 67 | 68 | 2. Install the required packages: 69 | 70 | `pip install streamlit transformers` 71 | 72 | 3. Run the app: 73 | 74 | `streamlit run app.py` 75 | -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | import streamlit as st 2 | import random 3 | from transformers import AutoTokenizer, AutoModelForSeq2SeqLM 4 | 5 | tokenizer = AutoTokenizer.from_pretrained("Kaludi/chatgpt-gpt4-prompts-bart-large-cnn-samsum") 6 | model = AutoModelForSeq2SeqLM.from_pretrained("Kaludi/chatgpt-gpt4-prompts-bart-large-cnn-samsum", from_tf=True) 7 | 8 | def generate(prompt, max_new_tokens): 9 | batch = tokenizer(prompt, return_tensors="pt") 10 | generated_ids = model.generate(batch["input_ids"], max_new_tokens=max_new_tokens) 11 | output = tokenizer.batch_decode(generated_ids, skip_special_tokens=True) 12 | return output[0] 13 | 14 | st.title("ChatGPT-BingChat Prompt Generator") 15 | st.write("This app generates ChatGPT/BingChat & GPT-3 prompts using [this](https://huggingface.co/Kaludi/chatgpt-gpt4-prompts-bart-large-cnn-samsum) model trained by [Kaludi](https://huggingface.co/Kaludi/). Enter a role and a prompt will be generated based on it.") 16 | prompt = st.text_input("Enter a Role, Example: Virtual Assistant", placeholder="Text here", value="") 17 | max_new_tokens = st.slider("Select Max Tokens in Response", min_value=100, max_value=500, value=150, step=10) 18 | if st.button("Generate"): 19 | output = generate(prompt, max_new_tokens) 20 | st.write("Generated Prompt:", box=True) 21 | st.write("