Justin Grammens
commited on
Commit
·
1ec9871
1
Parent(s):
9d76faa
updated text and answer count
Browse files
app.py
CHANGED
@@ -80,29 +80,30 @@ def show_alert(result):
|
|
80 |
# Function to generate the essay using the template and answers
|
81 |
def stream_leadership_essay(*answers):
|
82 |
|
83 |
-
# Check if any field is empty
|
84 |
-
if any(answer.strip() == "" for answer in answers):
|
85 |
-
yield "All fields are required.", "All fields are required."
|
86 |
-
return
|
87 |
-
|
88 |
# Check if the email is valid
|
89 |
if "@" not in answers[28]:
|
90 |
-
yield "Invalid email address. Please enter a valid email address."
|
91 |
return
|
92 |
|
93 |
if (answers[29] != secretcode):
|
94 |
-
yield "Invalid secret code. Please try again."
|
95 |
return
|
96 |
|
97 |
-
|
98 |
# Format the prompt with the answers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
filled_prompt = prompt.format(
|
100 |
q1=answers[1], q2=answers[2], q3=answers[3], q4=answers[4],
|
101 |
q5=answers[5], q6=answers[6], q7=answers[7], q8=answers[8],
|
102 |
q9=answers[10], q10=answers[11],q11=answers[12], q12=answers[13],
|
103 |
-
q13=answers[
|
104 |
-
q17=answers[
|
105 |
-
q21=answers[
|
106 |
)
|
107 |
|
108 |
# Send the prompt as a HumanMessage and stream the response
|
@@ -126,8 +127,16 @@ with gr.Blocks(
|
|
126 |
gr.Markdown("# Personal Leadership Profile")
|
127 |
|
128 |
gr.Markdown("""
|
129 |
-
According to 40 years of research by Kouzes and Posner, the most influential leaders have a clear Personal Leadership Philosophy (PLP) and communicate it frequently.
|
130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
Thank you for completing the PLP questions - It will be a cornerstone of your continued growth and development.
|
132 |
""")
|
133 |
|
|
|
80 |
# Function to generate the essay using the template and answers
|
81 |
def stream_leadership_essay(*answers):
|
82 |
|
|
|
|
|
|
|
|
|
|
|
83 |
# Check if the email is valid
|
84 |
if "@" not in answers[28]:
|
85 |
+
yield "Invalid email address. Please enter a valid email address."
|
86 |
return
|
87 |
|
88 |
if (answers[29] != secretcode):
|
89 |
+
yield "Invalid secret code. Please try again."
|
90 |
return
|
91 |
|
|
|
92 |
# Format the prompt with the answers
|
93 |
+
# Ensure at least 10 properties are filled, but only the ones that are textboxes
|
94 |
+
filled_answers = [answer for i, answer in enumerate(answers[:27]) if isinstance(inputs[i], gr.Textbox) and answer.strip() != ""]
|
95 |
+
|
96 |
+
if len(filled_answers) < 10:
|
97 |
+
yield "Please complete at least 10 questions with a minimum of two sentences for each answer."
|
98 |
+
return
|
99 |
+
|
100 |
filled_prompt = prompt.format(
|
101 |
q1=answers[1], q2=answers[2], q3=answers[3], q4=answers[4],
|
102 |
q5=answers[5], q6=answers[6], q7=answers[7], q8=answers[8],
|
103 |
q9=answers[10], q10=answers[11],q11=answers[12], q12=answers[13],
|
104 |
+
q13=answers[14], q14=answers[15], q15=answers[16], q16=answers[17],
|
105 |
+
q17=answers[19], q18=answers[20], q19=answers[21], q20=answers[22],
|
106 |
+
q21=answers[23], q22=answers[24], q23=answers[25], q24=answers[26]
|
107 |
)
|
108 |
|
109 |
# Send the prompt as a HumanMessage and stream the response
|
|
|
127 |
gr.Markdown("# Personal Leadership Profile")
|
128 |
|
129 |
gr.Markdown("""
|
130 |
+
According to 40 years of research by Kouzes and Posner, the most influential leaders have a clear Personal Leadership Philosophy (PLP) and communicate it frequently. Like a great coach, you have an explicit philosophy or approach to work that is clearly communicated to others.
|
131 |
+
|
132 |
+
Whether you’re a seasoned leader or just getting started in a leadership role, a PLP will allow you to articulate your values, goals, and the type of leader you aspire to be.
|
133 |
+
|
134 |
+
The result is a strategic tool to help you improve your culture.
|
135 |
+
|
136 |
+
**Please choose TEN or more of the following questions to answer. Please provide a minimum of two sentences for each answer.**
|
137 |
+
|
138 |
+
Based on your answers, we will build a “draft” for you to revise, build upon, and use as a roadmap.
|
139 |
+
|
140 |
Thank you for completing the PLP questions - It will be a cornerstone of your continued growth and development.
|
141 |
""")
|
142 |
|