Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -19,9 +19,7 @@ def limit_input_length(user_input, max_length=1000):
|
|
19 |
user_input = user_input[:max_length]
|
20 |
return user_input
|
21 |
|
22 |
-
def
|
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}]
|
@@ -30,8 +28,12 @@ def get_project_scope(describe_your_project_idea_here):
|
|
30 |
messages=messages,
|
31 |
temperature=0,
|
32 |
)
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
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 """
|
@@ -45,12 +47,12 @@ def get_change_impact_assessment(describe_your_project_idea_here):
|
|
45 |
temperature=0,
|
46 |
)
|
47 |
project_scope = response.choices[0].message["content"]
|
48 |
-
return
|
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=[
|
56 |
iface.launch()
|
|
|
19 |
user_input = user_input[:max_length]
|
20 |
return user_input
|
21 |
|
22 |
+
def get_response_from_llm(describe_your_project_idea_here):
|
|
|
|
|
23 |
describe_your_project_idea_here = sanitize_input(describe_your_project_idea_here)
|
24 |
describe_your_project_idea_here = limit_input_length(describe_your_project_idea_here, max_length=1000)
|
25 |
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 |
messages=messages,
|
29 |
temperature=0,
|
30 |
)
|
31 |
+
return response.choices[0].message["content"]
|
32 |
+
|
33 |
+
def get_project_scope(describe_your_project_idea_here):
|
34 |
+
task =f""" Your task is to help a university lecturer create a project scope table for """
|
35 |
+
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."""
|
36 |
+
return get_response_from_llm(describe_your_project_idea_here)
|
37 |
|
38 |
def get_change_impact_assessment(describe_your_project_idea_here):
|
39 |
task =f""" Your task is to help a university lecturer create a change impact assessment for """
|
|
|
47 |
temperature=0,
|
48 |
)
|
49 |
project_scope = response.choices[0].message["content"]
|
50 |
+
return project_scope
|
51 |
|
52 |
def get_scope_and_change_impact_assessment(describe_your_project_idea_here):
|
53 |
scope = get_project_scope(describe_your_project_idea_here)
|
54 |
change_impact = get_change_impact_assessment(describe_your_project_idea_here)
|
55 |
return scope, change_impact
|
56 |
|
57 |
+
iface = gr.Interface(fn=get_scope_and_change_impact_assessment, inputs="text", outputs=['markdown','markdown'], title="Project scope and change impact assessment", description="Enter your project e.g. I want to deliver more authentica assessments and this will ideate some project scope and change impact assessment for you."))
|
58 |
iface.launch()
|