import gradio as gr import os from transformers import pipeline title = "📗Health and Mindful Story Gen❤️" examples = [ ["Mental Body Scan"], ["Stretch, Calm, Breath"], ["Relaxed Seat Breath"], ["Walk Feel"], ["Brain gamification"], ["alleviating stress"], ["helping breathing, satisfaction"], ["Relieve Stress, Build Support"], ["Relaxation Response"], ["Deep Breaths"], ["Delete Not Helpful Thoughts"], ["Strengthen Helpful"], ["Reprogram Pain Stress Reactions"], ["Sleep Better and Find Joy"], ["Yoga Sleep"], ["Being a Happier and Healthier Person"], ["Relieve Pain"], ["Learn to Use Mindfulness to Affect Well Being"], ["Build and Boost Mental Strength"], ["Spending Time Outdoors"], ["Daily Routine Tasks"], ["Eating and Drinking - Find Healthy Nutrition Habits"], ["Drinking - Find Reasons and Cut Back or Quit Entirely"], ["Feel better each day when you awake by"], ["Feel better physically by"], ["Practicing mindfulness each day"], ["Be happier by"], ["Meditation can improve health"], ["Spending time outdoors"], ["Stress is relieved by quieting your mind, getting exercise and time with nature"], ["Break the cycle of stress and anxiety"], ["Feel calm in stressful situations"], ["Deal with work pressure"], ["Learn to reduce feelings of overwhelmed"] ] HF_TOKEN = os.environ.get("HF_TOKEN") # get token from secrets, copy token value HF_TOKEN from Profile settings token into this repo settings generator2 = gr.Interface.load("huggingface/EleutherAI/gpt-neo-2.7B") # add api_key=HF_TOKEN to get over the quota error generator3 = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B") generator1 = gr.Interface.load("huggingface/gpt2-large") gr.Parallel( generator1, generator2, generator3, inputs=gr.inputs.Textbox(lines=5, label="Enter a sentence to get another sentence."), title=title, examples=examples ).launch(share=False)