├── 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 | ![image](https://user-images.githubusercontent.com/63890666/228079348-9df040ad-4068-4542-a9ad-319cb6717ccb.png) 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("
{}
".format(output), unsafe_allow_html=True) 22 | st.write("") 23 | st.write("
Examples:
",unsafe_allow_html=True, box=True) 24 | st.write("", unsafe_allow_html=True) 25 | with open("examples.txt", "r") as f: 26 | examples = f.readlines() 27 | random_examples = random.sample(examples, 5) 28 | for example in random_examples: 29 | example = example.strip() 30 | st.write("
• {}
".format(example), unsafe_allow_html=True) 31 | -------------------------------------------------------------------------------- /examples.txt: -------------------------------------------------------------------------------- 1 | Personal Finance Advisor 2 | Health and Wellness Coach 3 | Social Media Strategist 4 | Personal Shopper 5 | Resume Builder 6 | Language Tutor 7 | Virtual Assistant 8 | Graphic Designer 9 | SEO Analyst 10 | Web Developer 11 | IT Support Specialist 12 | Data Analyst 13 | Project Manager 14 | Human Resources Manager 15 | Business Consultant 16 | Marketing Manager 17 | Sales Representative 18 | Customer Service Representative 19 | Content Creator 20 | Photographer 21 | Film Director 22 | Musician 23 | Artist 24 | Chef 25 | Gardener 26 | Fitness Trainer 27 | Personal Trainer 28 | Therapist 29 | Life Coach 30 | Lawyer 31 | Accountant 32 | Economist 33 | Scientist 34 | Engineer 35 | Teacher 36 | Librarian 37 | Journalist 38 | Writer 39 | Historian 40 | Geographer 41 | Anthropologist 42 | Sociologist 43 | Psychologist 44 | Philosopher 45 | Theologian 46 | Archeologist 47 | Astronomer 48 | Biologist 49 | Zoologist 50 | Ecologist 51 | Event Planner 52 | Interior Designer 53 | Landscape Architect 54 | Real Estate Agent 55 | Home Inspector 56 | Mechanic 57 | Electrician 58 | Plumber 59 | Carpenter 60 | Roofer 61 | HVAC Technician 62 | Cleaner 63 | Nanny 64 | Pet Sitter 65 | Dog Walker 66 | Veterinarian 67 | Pharmacist 68 | Nurse 69 | Doctor 70 | Surgeon 71 | Dentist 72 | Optometrist 73 | Physical Therapist 74 | Massage Therapist 75 | Chiropractor 76 | Acupuncturist 77 | Naturopathic Doctor 78 | Psychologist 79 | Psychiatrist 80 | Social Worker 81 | Probation Officer 82 | Police Officer 83 | Firefighter 84 | Paramedic 85 | Emergency Medical Technician 86 | Military Service Member 87 | Diplomat 88 | Politician 89 | Activist 90 | Environmentalist 91 | Human Rights Advocate 92 | Animal Rights Activist 93 | Community Organizer 94 | Religious Leader 95 | Spiritual Advisor 96 | Yoga Instructor 97 | Meditation Teacher 98 | Personal Growth Coach 99 | Creativity Coach 100 | Executive Coach 101 | Wealth Manager 102 | Stock Broker 103 | Financial Planner 104 | Investment Banker 105 | Real Estate Developer 106 | Entrepreneur 107 | CEO 108 | CFO 109 | COO 110 | HR Manager 111 | Operations Manager 112 | Supply Chain Manager 113 | Marketing Director 114 | Product Manager 115 | Sales Manager 116 | Business Development Manager 117 | Software Developer 118 | Mobile App Developer 119 | Cloud Engineer 120 | Cybersecurity Specialist 121 | Database Administrator 122 | Network Engineer 123 | IT Manager 124 | Technical Writer 125 | UX Designer 126 | UI Designer 127 | Web Designer 128 | Game Developer 129 | Animator 130 | 3D Modeler 131 | Film Editor 132 | Sound Designer 133 | Music Producer 134 | DJ 135 | Stand-up Comedian 136 | Improviser 137 | Magician 138 | Illusionist 139 | Circus Performer 140 | Dancer 141 | Choreographer 142 | Theater Director 143 | Playwright 144 | Screenwriter 145 | Film Critic 146 | Book Reviewer 147 | Food Critic 148 | Art Critic 149 | Fashion Critic 150 | Music Critic -------------------------------------------------------------------------------- /images/ChatGPT-Prompt-Gen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kaludii/ChatGPT-BingChat-GPT4-Prompt-Generator/11e2dbeb8ba0bb48e11bf9608ff57de66cce23aa/images/ChatGPT-Prompt-Gen.png -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | tensorflow 2 | transformers 3 | torch --------------------------------------------------------------------------------