Tycohs commited on
Commit
e0c3074
·
1 Parent(s): fc2b768

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +69 -2
app.py CHANGED
@@ -34,13 +34,16 @@ with gr.Blocks() as demo:
34
  with gr.Row():
35
  expert1 = gr.Textbox(label="Participant 1", lines=5)
36
  expert2 = gr.Textbox(label="Participant 2", lines=5)
 
37
  expert3 = gr.Textbox(label="Participant 3", lines=5)
38
  expert4 = gr.Textbox(label="Participant 4", lines=5)
39
- expert5 = gr.Textbox(label="Participant 5", lines=5)
40
  with gr.Row():
 
41
  expert6 = gr.Textbox(label="Participant 6", lines=5)
 
42
  expert7 = gr.Textbox(label="Participant 7", lines=5)
43
  expert8 = gr.Textbox(label="Participant 8", lines=5)
 
44
  expert9 = gr.Textbox(label="Participant 9", lines=5)
45
  expert10 = gr.Textbox(label="Participant 10", lines=5)
46
  with gr.Tab("Results"):
@@ -51,12 +54,16 @@ with gr.Blocks() as demo:
51
  with gr.Row():
52
  response1 = gr.Textbox(label="Response 1", lines=10)
53
  response2 = gr.Textbox(label="Response 2", lines=10)
 
54
  response3 = gr.Textbox(label="Response 3", lines=10)
55
  response4 = gr.Textbox(label="Response 4", lines=10)
 
56
  response5 = gr.Textbox(label="Response 5", lines=10)
57
  response6 = gr.Textbox(label="Response 6", lines=10)
 
58
  response7 = gr.Textbox(label="Response 7", lines=10)
59
  response8 = gr.Textbox(label="Response 8", lines=10)
 
60
  response9 = gr.Textbox(label="Response 9", lines=10)
61
  response10 = gr.Textbox(label="Response 10", lines=10)
62
  with gr.Tab("Summary"):
@@ -154,6 +161,65 @@ Now please provide your summary.
154
  """
155
  formattedprompt = [{'role':'system','content':system_message},{'role':'user','content':prompt}]
156
  result = answer(formattedprompt)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
 
158
  def generateanswers(title, question1, question2, question3, expert1, expert2, expert3, expert4, expert5, expert6, expert7, expert8, expert9, expert10):
159
  personalities = [expert1, expert2, expert3, expert4, expert5, expert6, expert7, expert8, expert9, expert10]
@@ -173,6 +239,7 @@ Question 3: {question3}
173
  Follow these rules:
174
  - Repeat the question first starting with "Question 1: ... then provide the answer at the line
175
  - Answer as the personality specified would, don't give answers that would not match this persona
 
176
  - Answer in minimum 5 sentences and maximum 10 sentences
177
  - Don't be too moralizing (environment safety, social impact...)
178
  - Use the style and vernacular language or the age and location (in English though)
@@ -181,7 +248,7 @@ Here is 1 example of answers for inspiration for a focus group on outdoor activi
181
  Marital Status: Single
182
 
183
  Question 1: What are the criteria for you to choose your outing activities?
184
- As Wong Kai, when I’m picking my activities, it boils down to three things really - fun, friends, and a bit of a workout. Like, I’m super into sports, so something like hiking or basketball is totally up my alley. And of course, my mates have got to be there, it’s always more fun when the gang’s together!
185
 
186
  Question 2: What activities would you recommend for teenagers in summer?
187
  Well, for my fellow teens in Hong Kong, I have to say, don’t miss out on the hikes on Lantau Island or any of the fab beach outings. There’s no better way to beat the heat than a dip in the sea after a killer hike. And sports, guys - just grab a ball and hit the nearest park, works every time. Summer in the city isn’t complete without a few local events too, brings everyone together.
 
34
  with gr.Row():
35
  expert1 = gr.Textbox(label="Participant 1", lines=5)
36
  expert2 = gr.Textbox(label="Participant 2", lines=5)
37
+ with gr.Row():
38
  expert3 = gr.Textbox(label="Participant 3", lines=5)
39
  expert4 = gr.Textbox(label="Participant 4", lines=5)
 
40
  with gr.Row():
41
+ expert5 = gr.Textbox(label="Participant 5", lines=5)
42
  expert6 = gr.Textbox(label="Participant 6", lines=5)
43
+ with gr.Row():
44
  expert7 = gr.Textbox(label="Participant 7", lines=5)
45
  expert8 = gr.Textbox(label="Participant 8", lines=5)
46
+ with gr.Row():
47
  expert9 = gr.Textbox(label="Participant 9", lines=5)
48
  expert10 = gr.Textbox(label="Participant 10", lines=5)
49
  with gr.Tab("Results"):
 
54
  with gr.Row():
55
  response1 = gr.Textbox(label="Response 1", lines=10)
56
  response2 = gr.Textbox(label="Response 2", lines=10)
57
+ with gr.Row():
58
  response3 = gr.Textbox(label="Response 3", lines=10)
59
  response4 = gr.Textbox(label="Response 4", lines=10)
60
+ with gr.Row():
61
  response5 = gr.Textbox(label="Response 5", lines=10)
62
  response6 = gr.Textbox(label="Response 6", lines=10)
63
+ with gr.Row():
64
  response7 = gr.Textbox(label="Response 7", lines=10)
65
  response8 = gr.Textbox(label="Response 8", lines=10)
66
+ with gr.Row():
67
  response9 = gr.Textbox(label="Response 9", lines=10)
68
  response10 = gr.Textbox(label="Response 10", lines=10)
69
  with gr.Tab("Summary"):
 
161
  """
162
  formattedprompt = [{'role':'system','content':system_message},{'role':'user','content':prompt}]
163
  result = answer(formattedprompt)
164
+ result = f"""
165
+ This is summary report on a focus group whith title is:
166
+ {title}
167
+
168
+ --- Summary report ---
169
+ {result}
170
+ --- APPENDIX / Profiles and Raw results from participants ---
171
+
172
+ Profile 1:
173
+ {expert1}
174
+ His answers were:
175
+ {response1}
176
+
177
+ Profile 2:
178
+ {expert2}
179
+ His answers were:
180
+ {response2}
181
+
182
+ Profile 3:
183
+ {expert3}
184
+ His answers were:
185
+ {response3}
186
+
187
+ Profile 4:
188
+ {expert4}
189
+ His answers were:
190
+ {response4}
191
+
192
+ Profile 5:
193
+ {expert5}
194
+ His answers were:
195
+ {response5}
196
+
197
+ Profile 6:
198
+ {expert6}
199
+ His answers were:
200
+ {response6}
201
+
202
+ Profile 7:
203
+ {expert7}
204
+ His answers were:
205
+ {response7}
206
+
207
+ Profile 8:
208
+ {expert8}
209
+ His answers were:
210
+ {response8}
211
+
212
+ Profile 9:
213
+ {expert9}
214
+ His answers were:
215
+ {response9}
216
+
217
+ Profile 10:
218
+ {expert10}
219
+ His answers were:
220
+ {response10}
221
+ """
222
+ return result
223
 
224
  def generateanswers(title, question1, question2, question3, expert1, expert2, expert3, expert4, expert5, expert6, expert7, expert8, expert9, expert10):
225
  personalities = [expert1, expert2, expert3, expert4, expert5, expert6, expert7, expert8, expert9, expert10]
 
239
  Follow these rules:
240
  - Repeat the question first starting with "Question 1: ... then provide the answer at the line
241
  - Answer as the personality specified would, don't give answers that would not match this persona
242
+ - Don't start by reminding your identity, provide your answer directly (we know who you are impersonating)
243
  - Answer in minimum 5 sentences and maximum 10 sentences
244
  - Don't be too moralizing (environment safety, social impact...)
245
  - Use the style and vernacular language or the age and location (in English though)
 
248
  Marital Status: Single
249
 
250
  Question 1: What are the criteria for you to choose your outing activities?
251
+ When I’m picking my activities, it boils down to three things really - fun, friends, and a bit of a workout. Like, I’m super into sports, so something like hiking or basketball is totally up my alley. And of course, my mates have got to be there, it’s always more fun when the gang’s together!
252
 
253
  Question 2: What activities would you recommend for teenagers in summer?
254
  Well, for my fellow teens in Hong Kong, I have to say, don’t miss out on the hikes on Lantau Island or any of the fab beach outings. There’s no better way to beat the heat than a dip in the sea after a killer hike. And sports, guys - just grab a ball and hit the nearest park, works every time. Summer in the city isn’t complete without a few local events too, brings everyone together.