import gradio as gr import os from transformers import pipeline title = "📗Health and Mindful Story Gen❤️" examples = [ ["Little interest or pleasure in doing things is caused by"], ["Little interest or pleasure in doing things is cured by"], ["Feeling down, depressed, or hopeless"], ["Trouble falling or staying asleep, or sleeping too much"], ["Feeling tired or having little energy"], ["Poor appetite or overeating"], ["Feeling bad about yourself - or that you are a failure or have let yourself or your family down"], ["Trouble concentrating on things, such as reading the newspaper or watching television"], ["Moving or speaking so slowly that other people could have noticed. Or the opposite - being so fidgety or restless that you have been moving around a lot more than usual"], ["Thoughts that you would be better off dead, or of hurting yourself in some way"], ["How difficult have these made it for you to do your work, take care of things at home, or get along with other people"], ["Music and art make me feel"], ["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"] ] from gradio import inputs from gradio.inputs import Textbox from gradio import outputs 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", api_key=HF_TOKEN) # add api_key=HF_TOKEN to get over the quota error generator3 = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B", api_key=HF_TOKEN) generator1 = gr.Interface.load("huggingface/gpt2-large", api_key=HF_TOKEN) 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)