diana3135 commited on
Commit
f0655bd
·
1 Parent(s): c8eeec1

word limit from 50 to 100 for all generation, refinement, and merge

Browse files
Files changed (4) hide show
  1. app.py +4 -4
  2. constants.py +1 -1
  3. instructions.py +4 -2
  4. utils.py +5 -5
app.py CHANGED
@@ -141,7 +141,7 @@ def login(identification_code):
141
  def word_limit_validation(human_input):
142
  words = human_input.split()
143
  if len(words) < WORD_LIMIT_MIN:
144
- return f"Error: Please enter at least 50 words."
145
  return None
146
 
147
  def on_textbox_change(session_index, session_manager, service, SHEET_ID):
@@ -209,7 +209,7 @@ if __name__ == "__main__":
209
 
210
  with group_a_content:
211
  with gr.Row():
212
- human_input = gr.Textbox(label="Enter each idea on a new line (Shift+Enter), starting with '1', '2', and '3'.", placeholder="Please propose 3 ideas to help Airbnb’s business model align with 17 SDGs (At least 50 words)")
213
  word_count_display_a = gr.Label(value="Word count: 0")
214
  human_input.change(fn=update_word_count, inputs=human_input, outputs=word_count_display_a)
215
  with gr.Row():
@@ -257,7 +257,7 @@ if __name__ == "__main__":
257
  with gr.Row():
258
  initial_answer = gr.Textbox(label="AI Output", interactive=False)
259
  with gr.Row():
260
- modification_suggestions = gr.Textbox(label="Please refine AI's three ideas as your final answer, starting with '1', '2', and '3'.", placeholder="Please propose 3 ideas to help Airbnb’s business model align with 17 SDGs (At least 50 words)")
261
  word_count_display_b = gr.Label(value="Word count: 0")
262
  modification_suggestions.change(fn=update_word_count, inputs=modification_suggestions, outputs=word_count_display_b)
263
  modification_suggestions.change(fn=check_initial_generated, inputs = [initial_answer] )
@@ -313,7 +313,7 @@ if __name__ == "__main__":
313
 
314
  with group_c_content:
315
  with gr.Row():
316
- human_input = gr.Textbox(label="Enter each idea on a new line (Shift+Enter), starting with '1', '2', and '3'.", placeholder="Please propose 3 ideas to help Airbnb’s business model align with 17 SDGs (At least 50 words)")
317
  word_count_display_c = gr.Label(value="Word count: 0")
318
  human_input.change(fn=update_word_count, inputs=human_input, outputs=word_count_display_c)
319
  with gr.Row():
 
141
  def word_limit_validation(human_input):
142
  words = human_input.split()
143
  if len(words) < WORD_LIMIT_MIN:
144
+ return f"Error: Please enter at least 100 words."
145
  return None
146
 
147
  def on_textbox_change(session_index, session_manager, service, SHEET_ID):
 
209
 
210
  with group_a_content:
211
  with gr.Row():
212
+ human_input = gr.Textbox(label="Enter each idea on a new line (Shift+Enter), starting with '1', '2', and '3'.", placeholder="Please propose 3 ideas to help Airbnb’s business model align with 17 SDGs (At least 100 words)")
213
  word_count_display_a = gr.Label(value="Word count: 0")
214
  human_input.change(fn=update_word_count, inputs=human_input, outputs=word_count_display_a)
215
  with gr.Row():
 
257
  with gr.Row():
258
  initial_answer = gr.Textbox(label="AI Output", interactive=False)
259
  with gr.Row():
260
+ modification_suggestions = gr.Textbox(label="Please refine AI's three ideas as your final answer, starting with '1', '2', and '3'.", placeholder="Please propose 3 ideas to help Airbnb’s business model align with 17 SDGs (At least 100 words)")
261
  word_count_display_b = gr.Label(value="Word count: 0")
262
  modification_suggestions.change(fn=update_word_count, inputs=modification_suggestions, outputs=word_count_display_b)
263
  modification_suggestions.change(fn=check_initial_generated, inputs = [initial_answer] )
 
313
 
314
  with group_c_content:
315
  with gr.Row():
316
+ human_input = gr.Textbox(label="Enter each idea on a new line (Shift+Enter), starting with '1', '2', and '3'.", placeholder="Please propose 3 ideas to help Airbnb’s business model align with 17 SDGs (At least 100 words)")
317
  word_count_display_c = gr.Label(value="Word count: 0")
318
  human_input.change(fn=update_word_count, inputs=human_input, outputs=word_count_display_c)
319
  with gr.Row():
constants.py CHANGED
@@ -1,4 +1,4 @@
1
- WORD_LIMIT_MIN = 50
2
  GROUP_SEPERATION = 1000
3
  LOCAL_PARAMS = False
4
 
 
1
+ WORD_LIMIT_MIN = 100
2
  GROUP_SEPERATION = 1000
3
  LOCAL_PARAMS = False
4
 
instructions.py CHANGED
@@ -51,7 +51,7 @@ def invalid_group():
51
 
52
  def notes_for_participants():
53
  NOTES = """
54
- You will receive basic compensation 💰 for a valid response of at least 50 words.
55
  Your final answer will be evaluated. If it ranks in the top 30 of 600 participants, you’ll earn an extra 🎁 $15.
56
  """
57
 
@@ -59,7 +59,9 @@ def notes_for_participants():
59
 
60
  def default_task_discription():
61
  TASK_DESCRIPTION = """
62
- Given Airbnb's current business model below, please propose three ideas to make it comply with the 17 SDGs. 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).
 
 
63
 
64
  Airbnb caters to two main groups:
65
  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.
 
51
 
52
  def notes_for_participants():
53
  NOTES = """
54
+ You will receive basic compensation 💰 for a valid response of at least 100 words.
55
  Your final answer will be evaluated. If it ranks in the top 30 of 600 participants, you’ll earn an extra 🎁 $15.
56
  """
57
 
 
59
 
60
  def default_task_discription():
61
  TASK_DESCRIPTION = """
62
+ 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.
63
+
64
+ 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).
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.
utils.py CHANGED
@@ -56,20 +56,20 @@ def generate_ai_initial_answer(task_description, api_key=None):
56
  def merge_texts_parallel(task_description, human_text, ai_text, api_key = None):
57
  prompt = (
58
  "You are tasked with merging two answers into a single, coherent, and logically structured response. "
59
- "Your response should synthesize the strengths of both answers, eliminate redundancy, and ensure a logical flow. "
60
  "Follow this structured chain of thought to guide your process:\n\n"
61
  "1. Understand the Task: Start by carefully analyzing the task description to ensure your final response aligns fully with the objective.\n"
62
  "2. Extract Key Points: Review both answers and identify the key ideas and arguments they present.\n"
63
  "3. Resolve Redundancies and Conflicts: Compare the two answers to eliminate repetitive content and resolve any contradictions.\n"
64
  "4. Integrate Seamlessly: Combine the extracted points into a single, unified response, ensuring a logical and coherent structure.\n"
65
- "5. Refine for Clarity: Polish the final response for clarity, conciseness, and alignment with the task requirements.\n\n"
66
  "Task Description:\n"
67
  f"{task_description}\n\n"
68
  "Answer 1:\n"
69
  f"{human_text}\n\n"
70
  "Answer 2:\n"
71
  f"{ai_text}\n\n"
72
- "Provide the unified and refined response below, marked clearly as the final version."
73
  )
74
  return generate_text_with_gpt(prompt, api_key)
75
 
@@ -77,14 +77,14 @@ def merge_texts_sequential(task_description, human_text, api_key = None):
77
  prompt = (
78
  f"Given the task: {task_description}, here is the response provided by the human:\n"
79
  f"{human_text}\n\n"
80
- "Your task is to refine the human's response while ensuring that the final answer fully aligns with the objectives for this task. "
81
  "Follow this logical chain of thought:\n"
82
  "1. Understand the Intent: Analyze the human's response to identify their key points and intended message.\n"
83
  "2. Evaluate Clarity: Check for any ambiguities, gaps, or unclear phrasing in the response.\n"
84
  "3. Improve Coherence: Ensure the response flows logically and connects ideas seamlessly.\n"
85
  "4. Enhance Precision: Refine wording to be concise and impactful while preserving the human's original intent.\n"
86
  "5. Check Alignment: Confirm that the final response accurately represents and strengthens the human's input without introducing unintended changes.\n\n"
87
- "Provide the refined response below, clearly marked as the final version."
88
  )
89
 
90
  return generate_text_with_gpt(prompt, api_key)
 
56
  def merge_texts_parallel(task_description, human_text, ai_text, api_key = None):
57
  prompt = (
58
  "You are tasked with merging two answers into a single, coherent, and logically structured response. "
59
+ "Your response should synthesize the strengths of both answers, eliminate redundancy, and ensure a logical flow."
60
  "Follow this structured chain of thought to guide your process:\n\n"
61
  "1. Understand the Task: Start by carefully analyzing the task description to ensure your final response aligns fully with the objective.\n"
62
  "2. Extract Key Points: Review both answers and identify the key ideas and arguments they present.\n"
63
  "3. Resolve Redundancies and Conflicts: Compare the two answers to eliminate repetitive content and resolve any contradictions.\n"
64
  "4. Integrate Seamlessly: Combine the extracted points into a single, unified response, ensuring a logical and coherent structure.\n"
65
+ "5. Refine for Clarity: Polish the final response for clarity, conciseness, and alignment with the task description below.\n\n"
66
  "Task Description:\n"
67
  f"{task_description}\n\n"
68
  "Answer 1:\n"
69
  f"{human_text}\n\n"
70
  "Answer 2:\n"
71
  f"{ai_text}\n\n"
72
+ "Provide the merged response below."
73
  )
74
  return generate_text_with_gpt(prompt, api_key)
75
 
 
77
  prompt = (
78
  f"Given the task: {task_description}, here is the response provided by the human:\n"
79
  f"{human_text}\n\n"
80
+ "Your task is to refine the human's response while ensuring that the final answer fully aligns with the objectives for this task."
81
  "Follow this logical chain of thought:\n"
82
  "1. Understand the Intent: Analyze the human's response to identify their key points and intended message.\n"
83
  "2. Evaluate Clarity: Check for any ambiguities, gaps, or unclear phrasing in the response.\n"
84
  "3. Improve Coherence: Ensure the response flows logically and connects ideas seamlessly.\n"
85
  "4. Enhance Precision: Refine wording to be concise and impactful while preserving the human's original intent.\n"
86
  "5. Check Alignment: Confirm that the final response accurately represents and strengthens the human's input without introducing unintended changes.\n\n"
87
+ "Provide the refined response below."
88
  )
89
 
90
  return generate_text_with_gpt(prompt, api_key)