Justin Grammens commited on
Commit
fe62f5d
·
1 Parent(s): 59f148c

updated changes

Browse files
Files changed (1) hide show
  1. app.py +23 -7
app.py CHANGED
@@ -12,10 +12,7 @@ llm = ChatOpenAI(model="gpt-3.5-turbo", temperature=.8)
12
 
13
  # Define a reusable prompt template using LangChain
14
  template = """
15
- Turn these questions and answers into a four-paragraph essay about my approach to leadership.
16
- Please write the essay in the first person, using a conversational and engaging style,
17
- as if you're chatting with a friend. Use simple, relatable language and avoid formalities.
18
- Add personal touches and insights to make it feel genuine and approachable.
19
 
20
  Questions and Answers:
21
  1. Three words that describe the culture: {q1}
@@ -40,6 +37,11 @@ prompt = PromptTemplate(
40
  # Function to generate the essay using the template and answers
41
  def stream_leadership_essay(*answers):
42
 
 
 
 
 
 
43
  if (answers[11] != secretcode):
44
  yield "Invalid secret code. Please try again.", "Invalid secret code. Please try again."
45
  return
@@ -60,8 +62,20 @@ def stream_leadership_essay(*answers):
60
  yield essay, filled_prompt # Yield partial essay to the Gradio output in real-time
61
 
62
  # Define the Gradio interface (form layout)
63
- with gr.Blocks() as demo:
64
- gr.Markdown("## Leadership Insights Form")
 
 
 
 
 
 
 
 
 
 
 
 
65
 
66
  inputs = [
67
  gr.Textbox(label="Three words that describe the culture we are building include..."),
@@ -75,9 +89,11 @@ with gr.Blocks() as demo:
75
  gr.Textbox(label="Others have described my management style as..."),
76
  gr.Textbox(label="To excel with me, you need to do three things..."),
77
  gr.Textbox(label="When working with me, always feel free to..."),
78
- gr.Textbox(label="REQUIRED: PLEASE ENTER THE SECRET CODE:"),
79
  ]
80
 
 
 
81
  submit_button = gr.Button("Submit")
82
 
83
  # Output area for the response summary
 
12
 
13
  # Define a reusable prompt template using LangChain
14
  template = """
15
+ Turn these questions and answers into a five-paragraph essay about my approach to leadership. Please write the essay in the first person, using a conversational and engaging style, as if talking with a friend. Use simple, relatable language and avoid formalities. If needed, you may add a little text to add texture and depth to answers as long as it aligns with the research on effective leadership. Likewise, add personal touches and insights to make it feel genuine and approachable.
 
 
 
16
 
17
  Questions and Answers:
18
  1. Three words that describe the culture: {q1}
 
37
  # Function to generate the essay using the template and answers
38
  def stream_leadership_essay(*answers):
39
 
40
+ # Check if any field is empty
41
+ if any(answer.strip() == "" for answer in answers):
42
+ yield "All fields are required.", "All fields are required."
43
+ return
44
+
45
  if (answers[11] != secretcode):
46
  yield "Invalid secret code. Please try again.", "Invalid secret code. Please try again."
47
  return
 
62
  yield essay, filled_prompt # Yield partial essay to the Gradio output in real-time
63
 
64
  # Define the Gradio interface (form layout)
65
+ with gr.Blocks(
66
+ theme=gr.themes.Soft()
67
+ ) as demo:
68
+ gr.Markdown("# Personal Leadership Profile")
69
+
70
+ gr.Markdown("""
71
+ Like a great coach, great leaders have a solid understanding of their philosophy and consistently share it with others on the team. They passionately pursue excellence in their role. Leadership experts Jim Kouzes and Barry Posner said it this way - “Leading others begins with leading yourself, and you can’t do that until you will be able to answer that fundamental question about who you are. So, ‘who are you?’"
72
+
73
+ According to 40 years of research by Kouzes and Posner, the most influential leaders have a clear Personal Leadership Profile (PLP) and communicate it often. 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. The result is a strategic tool to help you improve your culture.
74
+
75
+ Based on your answers, we will build a “draft” for you to revise, build upon, and use as a roadmap.
76
+
77
+ Thank you for completing the PLP questions. It will be a cornerstone of your continued development.
78
+ """)
79
 
80
  inputs = [
81
  gr.Textbox(label="Three words that describe the culture we are building include..."),
 
89
  gr.Textbox(label="Others have described my management style as..."),
90
  gr.Textbox(label="To excel with me, you need to do three things..."),
91
  gr.Textbox(label="When working with me, always feel free to..."),
92
+ gr.Textbox(label="Enter the password to generate the essay")
93
  ]
94
 
95
+ gr.Markdown("### I acknowledge that this is for learning purposes only.")
96
+
97
  submit_button = gr.Button("Submit")
98
 
99
  # Output area for the response summary