Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import os
|
3 |
+
from transformers import pipeline
|
4 |
+
|
5 |
+
title = "📗Health and Mindful Story Gen❤️"
|
6 |
+
|
7 |
+
examples = [
|
8 |
+
["Mental Body Scan"],
|
9 |
+
["Stretch, Calm, Breath"],
|
10 |
+
["Relaxed Seat Breath"],
|
11 |
+
["Walk Feel"],
|
12 |
+
["Brain gamification"],
|
13 |
+
["alleviating stress"],
|
14 |
+
["helping breathing, satisfaction"],
|
15 |
+
["Relieve Stress, Build Support"],
|
16 |
+
["Relaxation Response"],
|
17 |
+
["Deep Breaths"],
|
18 |
+
["Delete Not Helpful Thoughts"],
|
19 |
+
["Strengthen Helpful"],
|
20 |
+
["Reprogram Pain Stress Reactions"],
|
21 |
+
["Sleep Better and Find Joy"],
|
22 |
+
["Yoga Sleep"],
|
23 |
+
["Being a Happier and Healthier Person"],
|
24 |
+
["Relieve Pain"],
|
25 |
+
["Learn to Use Mindfulness to Affect Well Being"],
|
26 |
+
["Build and Boost Mental Strength"],
|
27 |
+
["Spending Time Outdoors"],
|
28 |
+
["Daily Routine Tasks"],
|
29 |
+
["Eating and Drinking - Find Healthy Nutrition Habits"],
|
30 |
+
["Drinking - Find Reasons and Cut Back or Quit Entirely"],
|
31 |
+
["Feel better each day when you awake by"],
|
32 |
+
["Feel better physically by"],
|
33 |
+
["Practicing mindfulness each day"],
|
34 |
+
["Be happier by"],
|
35 |
+
["Meditation can improve health"],
|
36 |
+
["Spending time outdoors"],
|
37 |
+
["Stress is relieved by quieting your mind, getting exercise and time with nature"],
|
38 |
+
["Break the cycle of stress and anxiety"],
|
39 |
+
["Feel calm in stressful situations"],
|
40 |
+
["Deal with work pressure"],
|
41 |
+
["Learn to reduce feelings of overwhelmed"]
|
42 |
+
]
|
43 |
+
|
44 |
+
HF_TOKEN = os.environ.get("HF_TOKEN") # get token from secrets, copy token value HF_TOKEN from Profile settings token into this repo settings
|
45 |
+
|
46 |
+
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
|
47 |
+
generator3 = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B", api_key=HF_TOKEN)
|
48 |
+
generator1 = gr.Interface.load("huggingface/gpt2-large", api_key=HF_TOKEN)
|
49 |
+
|
50 |
+
gr.Parallel(
|
51 |
+
generator1,
|
52 |
+
generator2,
|
53 |
+
generator3,
|
54 |
+
inputs=gr.inputs.Textbox(lines=5, label="Enter a sentence to get another sentence."),
|
55 |
+
title=title,
|
56 |
+
examples=examples
|
57 |
+
).launch(share=False)
|