Fiacre commited on
Commit
eaf95fb
1 Parent(s): 929c72a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -6
app.py CHANGED
@@ -19,25 +19,37 @@ def limit_input_length(user_input, max_length=1000):
19
  user_input = user_input[:max_length]
20
  return user_input
21
 
22
- task =f""" Your task is to help a university lecturer create a project scope table for """
23
- formatting = f"""Define what is the project objective, in scope, out of scope and assumptions. Do this in a tabular format. The table comprises six rows. The first row is a single column labeled "Project Objective". The second row is a single column stating the project objectives. The thid row contains two columns labeled "In Scope" and "Out of Scope". The fourth row contains two columns describing what is in scope and out of scope. The fifth row is a single column named "Assumptions". The sixth row is a single column describing the assumptions. Below each of these name, populate with detail content relevant to each title."""
24
- default_input = "I am looking to elevate our assessments and enable lecturers to develop more authentic assessments."
25
-
26
  def get_project_scope(describe_your_project_idea_here):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  describe_your_project_idea_here = sanitize_input(describe_your_project_idea_here)
28
  describe_your_project_idea_here = limit_input_length(describe_your_project_idea_here, max_length=1000)
29
  messages = [{"role": "user", "content": prompt_injection_check_pre + describe_your_project_idea_here + prompt_injection_check_post + task + describe_your_project_idea_here + formatting}]
30
  response = openai.ChatCompletion.create(
31
  model=model,
32
  messages=messages,
33
- temperature=0, # this is the degree of randomness of the model's output
34
  )
35
  project_scope = response.choices[0].message["content"]
36
  return project_scope
37
 
38
  def get_scope_and_change_impact_assessment(describe_your_project_idea_here):
39
  scope = get_project_scope(describe_your_project_idea_here)
40
- change_impact = get_project_scope(describe_your_project_idea_here)
41
  return scope, change_impact
42
 
43
  iface = gr.Interface(fn=get_scope_and_change_impact_assessment, inputs="text", outputs=["markdown", "markdown"])
 
19
  user_input = user_input[:max_length]
20
  return user_input
21
 
 
 
 
 
22
  def get_project_scope(describe_your_project_idea_here):
23
+ task =f""" Your task is to help a university lecturer create a project scope table for """
24
+ formatting = f"""Define what is the project objective, in scope, out of scope and assumptions. Do this in a tabular format. The table comprises six rows. The first row is a single column labeled "Project Objective". The second row is a single column stating the project objectives. The thid row contains two columns labeled "In Scope" and "Out of Scope". The fourth row contains two columns describing what is in scope and out of scope. The fifth row is a single column named "Assumptions". The sixth row is a single column describing the assumptions. Below each of these name, populate with detail content relevant to each title."""
25
+ describe_your_project_idea_here = sanitize_input(describe_your_project_idea_here)
26
+ describe_your_project_idea_here = limit_input_length(describe_your_project_idea_here, max_length=1000)
27
+ messages = [{"role": "user", "content": prompt_injection_check_pre + describe_your_project_idea_here + prompt_injection_check_post + task + describe_your_project_idea_here + formatting}]
28
+ response = openai.ChatCompletion.create(
29
+ model=model,
30
+ messages=messages,
31
+ temperature=0,
32
+ )
33
+ project_scope = response.choices[0].message["content"]
34
+ return project_scope
35
+
36
+ def get_change_impact_assessment(describe_your_project_idea_here):
37
+ task =f""" Your task is to help a university lecturer create a change impact assessment for """
38
+ formatting = f"""For each of these job aspects: Processes Systems Tools Job roles Critical behaviours Mindset/Attitudes/behaviour Reporting structure Performance reviews Compensation Location, Comment on these in a tabular format: Will this job aspect be impacted by the change? What are the specific details of the impact? What roles will be impacted by the change? Support options recommended: • Consultation • Training/ Instruction • Information/messaging • Coaching/mentoring • Other"""
39
  describe_your_project_idea_here = sanitize_input(describe_your_project_idea_here)
40
  describe_your_project_idea_here = limit_input_length(describe_your_project_idea_here, max_length=1000)
41
  messages = [{"role": "user", "content": prompt_injection_check_pre + describe_your_project_idea_here + prompt_injection_check_post + task + describe_your_project_idea_here + formatting}]
42
  response = openai.ChatCompletion.create(
43
  model=model,
44
  messages=messages,
45
+ temperature=0,
46
  )
47
  project_scope = response.choices[0].message["content"]
48
  return project_scope
49
 
50
  def get_scope_and_change_impact_assessment(describe_your_project_idea_here):
51
  scope = get_project_scope(describe_your_project_idea_here)
52
+ change_impact = get_change_impact_assessment(describe_your_project_idea_here)
53
  return scope, change_impact
54
 
55
  iface = gr.Interface(fn=get_scope_and_change_impact_assessment, inputs="text", outputs=["markdown", "markdown"])