Yuanjun commited on
Commit
ca5ef51
·
unverified ·
2 Parent(s): e116042 093aba3

Merge pull request #4 from ZnS77/bugfix/restore-task-description

Browse files
Files changed (2) hide show
  1. app.py +6 -8
  2. instructions.py +39 -40
app.py CHANGED
@@ -178,17 +178,15 @@ if __name__ == "__main__":
178
  login_status = gr.Textbox(label="Next Tasks", interactive=False)
179
  group = gr.State()
180
 
181
- with gr.Column(visible=False) as textbox_task:
182
  description = gr.Textbox(label="Task Description",
183
- value = human_task_description(),
184
  interactive=False,
185
  lines=12)
186
 
187
  with gr.Accordion(label = "Click to See 17 SDGs",
188
  open=False):
189
  gr.Markdown(SDG_DETAILS)
190
-
191
- ai_task_description = ai_task_description()
192
 
193
  # initialization of different group contents
194
  group_a_content = gr.Group(visible=False, elem_id="group-a")
@@ -208,7 +206,7 @@ if __name__ == "__main__":
208
  else:
209
  return gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), invalid_group()
210
 
211
- login_button.click(login, inputs=identification_code, outputs=[textbox_task, group_a_content, group_b_content, group_c_content, login_status])
212
 
213
 
214
 
@@ -225,7 +223,7 @@ if __name__ == "__main__":
225
 
226
  submit_btn.click(
227
  fn=lambda task, human_input, id: handle_create_sequential(task, human_input, session_manager, api_key, id),
228
- inputs=[ai_task_description, human_input, identification_code],
229
  outputs=[ai_output, session_index]
230
  )
231
 
@@ -276,7 +274,7 @@ if __name__ == "__main__":
276
 
277
  create_initial_btn.click(
278
  fn=lambda task, id: handle_create_reverse_sequential(task, session_manager, api_key, id),
279
- inputs=[ai_task_description, identification_code],
280
  outputs=[initial_answer, session_index]
281
  )
282
 
@@ -334,7 +332,7 @@ if __name__ == "__main__":
334
 
335
  create_btn.click(
336
  fn=lambda task, human_input, id: handle_create_parallel(task, human_input, session_manager, api_key, id),
337
- inputs=[ai_task_description, human_input, identification_code],
338
  outputs=[ai_initial_output, session_index]
339
  )
340
 
 
178
  login_status = gr.Textbox(label="Next Tasks", interactive=False)
179
  group = gr.State()
180
 
181
+ with gr.Column(visible=False) as task:
182
  description = gr.Textbox(label="Task Description",
183
+ value = default_task_description(),
184
  interactive=False,
185
  lines=12)
186
 
187
  with gr.Accordion(label = "Click to See 17 SDGs",
188
  open=False):
189
  gr.Markdown(SDG_DETAILS)
 
 
190
 
191
  # initialization of different group contents
192
  group_a_content = gr.Group(visible=False, elem_id="group-a")
 
206
  else:
207
  return gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), invalid_group()
208
 
209
+ login_button.click(login, inputs=identification_code, outputs=[task, group_a_content, group_b_content, group_c_content, login_status])
210
 
211
 
212
 
 
223
 
224
  submit_btn.click(
225
  fn=lambda task, human_input, id: handle_create_sequential(task, human_input, session_manager, api_key, id),
226
+ inputs=[description, human_input, identification_code],
227
  outputs=[ai_output, session_index]
228
  )
229
 
 
274
 
275
  create_initial_btn.click(
276
  fn=lambda task, id: handle_create_reverse_sequential(task, session_manager, api_key, id),
277
+ inputs=[description, identification_code],
278
  outputs=[initial_answer, session_index]
279
  )
280
 
 
332
 
333
  create_btn.click(
334
  fn=lambda task, human_input, id: handle_create_parallel(task, human_input, session_manager, api_key, id),
335
+ inputs=[description, human_input, identification_code],
336
  outputs=[ai_initial_output, session_index]
337
  )
338
 
instructions.py CHANGED
@@ -57,12 +57,11 @@ def notes_for_participants():
57
 
58
  return NOTES
59
 
60
- def human_task_description():
61
  # display the task description on the interface to human
62
  # TODO: Decorate the text to make it more readable
63
- HUMAN_TASK_DESCRIPTION = """
64
- Given Airbnb's current business model below, please propose three ideas to make it comply with the 17 SDGs.
65
- The final answer should be at least 100 words.
66
 
67
  Airbnb caters to two main groups:
68
  1. Travelers: People looking for unique and affordable places to stay, including tourists, business travelers, and families who prefer a home-like experience over hotels.
@@ -75,44 +74,44 @@ def human_task_description():
75
  - Safety and Support: Ensures safety with verification processes and offers reliable customer support.
76
  - Technology and Marketing: Invests in technology to improve user experience and efficiency, and uses marketing to attract and retain users.
77
  """
78
- return HUMAN_TASK_DESCRIPTION
79
 
80
- def ai_task_description():
81
- # task description passed to AI in the prompt
82
- AI_TASK_DESCRIPTION = """
83
- Given Airbnb's current business model below, please propose **three** ideas to make it comply with the 17 SDGs. Your output should be around **100** words in total.
84
 
85
- The final answer will be evaluated on Novelty (the uniqueness and originality of the ideas), Feasibility (the practicality and implementability of suggested actions), Inimitability (how difficult for competitors to replicate), and Goal Alignment (how aligned the ideas are with Airbnb’s business objectives and 17 SDGs).
86
 
87
- Airbnb caters to two main groups:
88
- 1. Travelers: People looking for unique and affordable places to stay, including tourists, business travelers, and families who prefer a home-like experience over hotels.
89
- 2. Property Owners: Individuals who rent out their spaces, from single rooms to entire homes, to earn extra income.
90
- Value for Guests and Hosts
91
- - For Guests: Airbnb offers a variety of unique places to stay, providing a local and authentic experience with secure booking.
92
- - For Hosts: Airbnb helps property owners make money by renting out their spaces and provides tools to list, price, and market their properties.
93
- How Airbnb Operates
94
- - User-Friendly Platform: Connects hosts with guests through an easy-to-use online marketplace.
95
- - Safety and Support: Ensures safety with verification processes and offers reliable customer support.
96
- - Technology and Marketing: Invests in technology to improve user experience and efficiency, and uses marketing to attract and retain users.
97
 
98
- 17 Sustainable Development Goals (SDGs):
99
 
100
- 1. No Poverty: Eradicate all forms of poverty.
101
- 2. Zero Hunger: End hunger and promote sustainable agriculture.
102
- 3. Good Health and Well-being: Ensure health and well-being for everyone.
103
- 4. Quality Education: Guarantee inclusive, quality education for all.
104
- 5. Gender Equality: Empower women and achieve gender equality.
105
- 6. Clean Water and Sanitation: Provide sustainable water and sanitation.
106
- 7. Affordable and Clean Energy: Ensure access to sustainable energy.
107
- 8. Decent Work and Economic Growth: Foster inclusive economic growth and decent jobs.
108
- 9. Industry, Innovation and Infrastructure: Build resilient infrastructure and promote innovation.
109
- 10. Reduced Inequality: Decrease inequality within and among countries.
110
- 11. Sustainable Cities and Communities: Develop safe and sustainable communities.
111
- 12. Responsible Consumption and Production: Ensure sustainable consumption and production.
112
- 13. Climate Action: Take action against climate change.
113
- 14. Life Below Water: Protect oceans and marine life.
114
- 15. Life on Land: Sustainably manage ecosystems and biodiversity.
115
- 16. Peace and Justice Strong Institutions: Promote peace, justice, and strong institutions.
116
- 17. Partnerships to achieve the Goals: Enhance global partnerships for sustainable development.
117
- """
118
- return AI_TASK_DESCRIPTION
 
57
 
58
  return NOTES
59
 
60
+ def default_task_description():
61
  # display the task description on the interface to human
62
  # TODO: Decorate the text to make it more readable
63
+ TASK_DESCRIPTION = """
64
+ Given Airbnb's current business model below, please propose three ideas to make it comply with the 17 Sustainable Development Goals (SDGs). Your answer should be around 100 words.
 
65
 
66
  Airbnb caters to two main groups:
67
  1. Travelers: People looking for unique and affordable places to stay, including tourists, business travelers, and families who prefer a home-like experience over hotels.
 
74
  - Safety and Support: Ensures safety with verification processes and offers reliable customer support.
75
  - Technology and Marketing: Invests in technology to improve user experience and efficiency, and uses marketing to attract and retain users.
76
  """
77
+ return TASK_DESCRIPTION
78
 
79
+ # def ai_task_description():
80
+ # # task description passed to AI in the prompt
81
+ # AI_TASK_DESCRIPTION = """
82
+ # Given Airbnb's current business model below, please propose **three** ideas to make it comply with the 17 SDGs. Your output should be around **100** words in total.
83
 
84
+ # The final answer will be evaluated on Novelty (the uniqueness and originality of the ideas), Feasibility (the practicality and implementability of suggested actions), Inimitability (how difficult for competitors to replicate), and Goal Alignment (how aligned the ideas are with Airbnb’s business objectives and 17 SDGs).
85
 
86
+ # Airbnb caters to two main groups:
87
+ # 1. Travelers: People looking for unique and affordable places to stay, including tourists, business travelers, and families who prefer a home-like experience over hotels.
88
+ # 2. Property Owners: Individuals who rent out their spaces, from single rooms to entire homes, to earn extra income.
89
+ # Value for Guests and Hosts
90
+ # - For Guests: Airbnb offers a variety of unique places to stay, providing a local and authentic experience with secure booking.
91
+ # - For Hosts: Airbnb helps property owners make money by renting out their spaces and provides tools to list, price, and market their properties.
92
+ # How Airbnb Operates
93
+ # - User-Friendly Platform: Connects hosts with guests through an easy-to-use online marketplace.
94
+ # - Safety and Support: Ensures safety with verification processes and offers reliable customer support.
95
+ # - Technology and Marketing: Invests in technology to improve user experience and efficiency, and uses marketing to attract and retain users.
96
 
97
+ # 17 Sustainable Development Goals (SDGs):
98
 
99
+ # 1. No Poverty: Eradicate all forms of poverty.
100
+ # 2. Zero Hunger: End hunger and promote sustainable agriculture.
101
+ # 3. Good Health and Well-being: Ensure health and well-being for everyone.
102
+ # 4. Quality Education: Guarantee inclusive, quality education for all.
103
+ # 5. Gender Equality: Empower women and achieve gender equality.
104
+ # 6. Clean Water and Sanitation: Provide sustainable water and sanitation.
105
+ # 7. Affordable and Clean Energy: Ensure access to sustainable energy.
106
+ # 8. Decent Work and Economic Growth: Foster inclusive economic growth and decent jobs.
107
+ # 9. Industry, Innovation and Infrastructure: Build resilient infrastructure and promote innovation.
108
+ # 10. Reduced Inequality: Decrease inequality within and among countries.
109
+ # 11. Sustainable Cities and Communities: Develop safe and sustainable communities.
110
+ # 12. Responsible Consumption and Production: Ensure sustainable consumption and production.
111
+ # 13. Climate Action: Take action against climate change.
112
+ # 14. Life Below Water: Protect oceans and marine life.
113
+ # 15. Life on Land: Sustainably manage ecosystems and biodiversity.
114
+ # 16. Peace and Justice Strong Institutions: Promote peace, justice, and strong institutions.
115
+ # 17. Partnerships to achieve the Goals: Enhance global partnerships for sustainable development.
116
+ # """
117
+ # return AI_TASK_DESCRIPTION