Rachel M Harrison
commited on
Update app notebook
Browse files
app.ipynb
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
-
"execution_count":
|
6 |
"id": "6b57ced9-62ee-44a0-a895-6ed288f970ff",
|
7 |
"metadata": {},
|
8 |
"outputs": [
|
@@ -10,7 +10,7 @@
|
|
10 |
"name": "stdout",
|
11 |
"output_type": "stream",
|
12 |
"text": [
|
13 |
-
"Running on local URL: http://127.0.0.1:
|
14 |
"\n",
|
15 |
"To create a public link, set `share=True` in `launch()`.\n"
|
16 |
]
|
@@ -18,7 +18,7 @@
|
|
18 |
{
|
19 |
"data": {
|
20 |
"text/html": [
|
21 |
-
"<div><iframe src=\"http://127.0.0.1:
|
22 |
],
|
23 |
"text/plain": [
|
24 |
"<IPython.core.display.HTML object>"
|
@@ -31,22 +31,22 @@
|
|
31 |
"name": "stdout",
|
32 |
"output_type": "stream",
|
33 |
"text": [
|
34 |
-
"desc='A
|
35 |
"\n",
|
36 |
"\n",
|
37 |
"You are writing motivational text messages to help people with their mental health. Messages should be friendly and positive, but also professional and super short. You are limited on space. Messages should be written at the reading level of an eighth grader. Word choice should be short and simple so everyone can understand. \n",
|
38 |
"\n",
|
39 |
"\n",
|
40 |
-
"You will be given some basic information about the person you are addressing.
|
41 |
"\n",
|
42 |
"\n",
|
43 |
"Write a short inspirational message for the person with the following description:\n",
|
44 |
"\n",
|
45 |
-
"A
|
46 |
"\n",
|
47 |
-
"Illustrate one simple, inspirational, fun image to help a person with their mental health.
|
48 |
"\n",
|
49 |
-
"Hey there! Remember, you
|
50 |
]
|
51 |
}
|
52 |
],
|
@@ -77,9 +77,8 @@
|
|
77 |
" choices=['White', 'Hispanic', 'Black', 'Asian', 'Unspecified'])\n",
|
78 |
"\n",
|
79 |
" # symptoms\n",
|
80 |
-
" disorders = ['Sadness', 'Inability to concentrate', '
|
81 |
-
" '
|
82 |
-
" 'Lack of appetite', 'Increased appetite']\n",
|
83 |
" symptoms = gr.CheckboxGroup(label='Symptoms', choices=disorders)\n",
|
84 |
"\n",
|
85 |
" # interests\n",
|
@@ -138,7 +137,7 @@
|
|
138 |
"Messages should be written at the reading level of an eighth grader. \\\n",
|
139 |
"Word choice should be short and simple so everyone can understand. \\n\\n\n",
|
140 |
"You will be given some basic information about the person you are addressing. \\\n",
|
141 |
-
"
|
142 |
"You should try to use the person's information to give them relevant and actionable tips for improving their mental health symptoms.'''\n",
|
143 |
" user_prompt = f'Write a short inspirational message for the person with the following description:\\n\\n{desc}'\n",
|
144 |
"\n",
|
@@ -158,7 +157,7 @@
|
|
158 |
" return Image.fromarray(np.random.randint(0, 255, (100, 100, 3), dtype='uint8'), 'RGB')\n",
|
159 |
"\n",
|
160 |
" # construct description of the person\n",
|
161 |
-
" desc = f'
|
162 |
" if race != 'Unspecified':\n",
|
163 |
" desc += f'{race.lower()} '\n",
|
164 |
" if gender == 'Male':\n",
|
@@ -169,9 +168,9 @@
|
|
169 |
" desc += 'non-binary person.'\n",
|
170 |
" else:\n",
|
171 |
" desc += 'person.'\n",
|
172 |
-
" prompt = 'Illustrate one simple, inspirational, fun image to help a person with their mental health.
|
173 |
-
" + f'The style is cute and illustrative. {desc} '\\\n",
|
174 |
-
" + f'The image should
|
175 |
"\n",
|
176 |
" print(f'\\n{prompt}')\n",
|
177 |
" response = client.images.generate(prompt=prompt, model='dall-e-3', response_format='b64_json')\n",
|
@@ -298,7 +297,7 @@
|
|
298 |
"name": "python",
|
299 |
"nbconvert_exporter": "python",
|
300 |
"pygments_lexer": "ipython3",
|
301 |
-
"version": "3.
|
302 |
}
|
303 |
},
|
304 |
"nbformat": 4,
|
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
+
"execution_count": 38,
|
6 |
"id": "6b57ced9-62ee-44a0-a895-6ed288f970ff",
|
7 |
"metadata": {},
|
8 |
"outputs": [
|
|
|
10 |
"name": "stdout",
|
11 |
"output_type": "stream",
|
12 |
"text": [
|
13 |
+
"Running on local URL: http://127.0.0.1:7949\n",
|
14 |
"\n",
|
15 |
"To create a public link, set `share=True` in `launch()`.\n"
|
16 |
]
|
|
|
18 |
{
|
19 |
"data": {
|
20 |
"text/html": [
|
21 |
+
"<div><iframe src=\"http://127.0.0.1:7949/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
|
22 |
],
|
23 |
"text/plain": [
|
24 |
"<IPython.core.display.HTML object>"
|
|
|
31 |
"name": "stdout",
|
32 |
"output_type": "stream",
|
33 |
"text": [
|
34 |
+
"desc='A 22 year old non-binary person. They like cats, cooking, swimming. They have the following mental health symptoms: sadness, inability to concentrate, extreme mood changes.'\n",
|
35 |
"\n",
|
36 |
"\n",
|
37 |
"You are writing motivational text messages to help people with their mental health. Messages should be friendly and positive, but also professional and super short. You are limited on space. Messages should be written at the reading level of an eighth grader. Word choice should be short and simple so everyone can understand. \n",
|
38 |
"\n",
|
39 |
"\n",
|
40 |
+
"You will be given some basic information about the person you are addressing. Messages should be short, so be discerning. You should try to use the person's information to give them relevant and actionable tips for improving their mental health symptoms.\n",
|
41 |
"\n",
|
42 |
"\n",
|
43 |
"Write a short inspirational message for the person with the following description:\n",
|
44 |
"\n",
|
45 |
+
"A 22 year old non-binary person. They like cats, cooking, swimming. They have the following mental health symptoms: sadness, inability to concentrate, extreme mood changes.\n",
|
46 |
"\n",
|
47 |
+
"Illustrate one simple, inspirational, fun image to help a person with their mental health. NO TEXT. The style is cute and illustrative. It is focused on a 22 year old hispanic non-binary person. The image should suit the following message:\n",
|
48 |
"\n",
|
49 |
+
"Hey there! π Remember, you're not alone in this journey. When sadness hits, try spending time with your furry friends or cooking up a delicious meal. π±π³ And when concentration gets tough, take a dip in the pool to clear your mind. Embrace your unique self and ride the waves of life with confidence. You've got this! πͺπ #YouAreStrong\n"
|
50 |
]
|
51 |
}
|
52 |
],
|
|
|
77 |
" choices=['White', 'Hispanic', 'Black', 'Asian', 'Unspecified'])\n",
|
78 |
"\n",
|
79 |
" # symptoms\n",
|
80 |
+
" disorders = ['Sadness', 'Inability to concentrate', 'Anxiety', 'Extreme mood changes',\n",
|
81 |
+
" 'Social withdrawal', 'Tiredness', 'Lack of appetite', 'Increased appetite']\n",
|
|
|
82 |
" symptoms = gr.CheckboxGroup(label='Symptoms', choices=disorders)\n",
|
83 |
"\n",
|
84 |
" # interests\n",
|
|
|
137 |
"Messages should be written at the reading level of an eighth grader. \\\n",
|
138 |
"Word choice should be short and simple so everyone can understand. \\n\\n\n",
|
139 |
"You will be given some basic information about the person you are addressing. \\\n",
|
140 |
+
"Messages should be short, so be discerning. \\\n",
|
141 |
"You should try to use the person's information to give them relevant and actionable tips for improving their mental health symptoms.'''\n",
|
142 |
" user_prompt = f'Write a short inspirational message for the person with the following description:\\n\\n{desc}'\n",
|
143 |
"\n",
|
|
|
157 |
" return Image.fromarray(np.random.randint(0, 255, (100, 100, 3), dtype='uint8'), 'RGB')\n",
|
158 |
"\n",
|
159 |
" # construct description of the person\n",
|
160 |
+
" desc = f'a {age} year old '\n",
|
161 |
" if race != 'Unspecified':\n",
|
162 |
" desc += f'{race.lower()} '\n",
|
163 |
" if gender == 'Male':\n",
|
|
|
168 |
" desc += 'non-binary person.'\n",
|
169 |
" else:\n",
|
170 |
" desc += 'person.'\n",
|
171 |
+
" prompt = 'Illustrate one simple, inspirational, fun image to help a person with their mental health. NO TEXT. '\\\n",
|
172 |
+
" + f'The style is cute and illustrative. It is focused on {desc} '\\\n",
|
173 |
+
" + f'The image should suit the following message:\\n\\n{nudge_message}'\n",
|
174 |
"\n",
|
175 |
" print(f'\\n{prompt}')\n",
|
176 |
" response = client.images.generate(prompt=prompt, model='dall-e-3', response_format='b64_json')\n",
|
|
|
297 |
"name": "python",
|
298 |
"nbconvert_exporter": "python",
|
299 |
"pygments_lexer": "ipython3",
|
300 |
+
"version": "3.11.5"
|
301 |
}
|
302 |
},
|
303 |
"nbformat": 4,
|