Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,14 +4,15 @@ 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 |
-
["
|
14 |
-
["
|
15 |
["Relieve Stress, Build Support"],
|
16 |
["Relaxation Response"],
|
17 |
["Deep Breaths"],
|
@@ -41,11 +42,10 @@ examples = [
|
|
41 |
["Learn to reduce feelings of overwhelmed"]
|
42 |
]
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
generator2 =
|
47 |
-
generator3 =
|
48 |
-
generator1 = gr.Interface.load("huggingface/gpt2-large", api_key=HF_TOKEN)
|
49 |
|
50 |
with gr.Blocks() as demo:
|
51 |
gr.Markdown(f"# {title}")
|
@@ -57,9 +57,9 @@ with gr.Blocks() as demo:
|
|
57 |
gen3_output = gr.Textbox(label="GPT-J Output")
|
58 |
|
59 |
def generate_outputs(input_text):
|
60 |
-
out1 = generator1(
|
61 |
-
out2 = generator2(
|
62 |
-
out3 = generator3(
|
63 |
return out1, out2, out3
|
64 |
|
65 |
gr.Button("Generate").click(
|
@@ -70,4 +70,4 @@ with gr.Blocks() as demo:
|
|
70 |
|
71 |
gr.Examples(examples=examples, inputs=input_textbox)
|
72 |
|
73 |
-
demo.launch(share=False)
|
|
|
4 |
|
5 |
title = "📗Health and Mindful Story Gen❤️"
|
6 |
|
7 |
+
# Define the examples to show in the interface
|
8 |
examples = [
|
9 |
["Mental Body Scan"],
|
10 |
["Stretch, Calm, Breath"],
|
11 |
["Relaxed Seat Breath"],
|
12 |
["Walk Feel"],
|
13 |
["Brain gamification"],
|
14 |
+
["Alleviating stress"],
|
15 |
+
["Helping breathing, satisfaction"],
|
16 |
["Relieve Stress, Build Support"],
|
17 |
["Relaxation Response"],
|
18 |
["Deep Breaths"],
|
|
|
42 |
["Learn to reduce feelings of overwhelmed"]
|
43 |
]
|
44 |
|
45 |
+
# Initialize the models using Hugging Face pipelines
|
46 |
+
generator1 = pipeline("text-generation", model="gpt2-large")
|
47 |
+
generator2 = pipeline("text-generation", model="EleutherAI/gpt-neo-2.7B")
|
48 |
+
generator3 = pipeline("text-generation", model="EleutherAI/gpt-j-6B")
|
|
|
49 |
|
50 |
with gr.Blocks() as demo:
|
51 |
gr.Markdown(f"# {title}")
|
|
|
57 |
gen3_output = gr.Textbox(label="GPT-J Output")
|
58 |
|
59 |
def generate_outputs(input_text):
|
60 |
+
out1 = generator1(input_text, max_length=50)[0]['generated_text']
|
61 |
+
out2 = generator2(input_text, max_length=50)[0]['generated_text']
|
62 |
+
out3 = generator3(input_text, max_length=50)[0]['generated_text']
|
63 |
return out1, out2, out3
|
64 |
|
65 |
gr.Button("Generate").click(
|
|
|
70 |
|
71 |
gr.Examples(examples=examples, inputs=input_textbox)
|
72 |
|
73 |
+
demo.launch(share=False)
|