Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files- app.py +39 -0
- requirements.txt +1 -0
app.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import os
|
| 3 |
+
from transformers import pipeline
|
| 4 |
+
title = "📗Health and Mindful Story Gen❤️"
|
| 5 |
+
examples = [
|
| 6 |
+
["Little interest or pleasure in doing things is caused by"],
|
| 7 |
+
["Little interest or pleasure in doing things is cured by"],
|
| 8 |
+
["Feeling down, depressed, or hopeless"],
|
| 9 |
+
["Trouble falling or staying asleep, or sleeping too much"],
|
| 10 |
+
["Feeling tired or having little energy"],
|
| 11 |
+
["Poor appetite or overeating"],
|
| 12 |
+
["Feeling bad about yourself - or that you are a failure or have let yourself or your family down"],
|
| 13 |
+
["Trouble concentrating on things, such as reading the newspaper or watching television"],
|
| 14 |
+
["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"],
|
| 15 |
+
["Thoughts that you would be better off dead, or of hurting yourself in some way"],
|
| 16 |
+
["How difficult have these made it for you to do your work, take care of things at home, or get along with other people"],
|
| 17 |
+
["Music and art make me feel"],
|
| 18 |
+
["Feel better each day when you awake by"],
|
| 19 |
+
["Feel better physically by"],
|
| 20 |
+
["Practicing mindfulness each day"],
|
| 21 |
+
["Be happier by"],
|
| 22 |
+
["Meditation can improve health"],
|
| 23 |
+
["Spending time outdoors"],
|
| 24 |
+
["Stress is relieved by quieting your mind, getting exercise and time with nature"],
|
| 25 |
+
["Break the cycle of stress and anxiety"],
|
| 26 |
+
["Feel calm in stressful situations"],
|
| 27 |
+
["Deal with work pressure"],
|
| 28 |
+
["Learn to reduce feelings of overwhelmed"]
|
| 29 |
+
]
|
| 30 |
+
from gradio import inputs
|
| 31 |
+
from gradio.inputs import Textbox
|
| 32 |
+
from gradio import outputs
|
| 33 |
+
|
| 34 |
+
HF_TOKEN = os.environ.get("HF_TOKEN") # get token from secrets, copy token value HF_TOKEN from Profile settings token into this repo settings
|
| 35 |
+
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
|
| 36 |
+
generator3 = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B", api_key=HF_TOKEN)
|
| 37 |
+
generator1 = gr.Interface.load("huggingface/gpt2-large", api_key=HF_TOKEN)
|
| 38 |
+
gr.Parallel(generator1, generator2, generator3, inputs=gr.inputs.Textbox(lines=5, label="Enter a sentence to get another sentence."),
|
| 39 |
+
title=title, examples=examples).launch(share=False)
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
transformers
|