QL2023 commited on
Commit
ed7db54
·
verified ·
1 Parent(s): d31048a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -32,11 +32,11 @@ def generate_ai_text(prompt,temperature):
32
  text = response["choices"][0]["message"]["content"]
33
  return text
34
 
35
- def generate_prompt(ini_prompt,no_login,low_activity,repeated_course,low_marks,WAM,forum_count,pre_fail,this_fail):
36
 
37
  body = ini_prompt
38
 
39
- data = f"Here are the indicators for the student:\n No Moodle Login: {no_login}\n Low Moodle Activity: {low_activity}\n Student is repeating this course: {repeated_course}\n Student has low marks: {low_marks}\n Student's WAM across all courses: {WAM}\n Student's forum activity: {forum_count}\n Count of student's previous fail of all courses: {pre_fail}\n Count of student's previous fail of this courses: {this_fail}\n "
40
 
41
  text = body + "\n\n" + data
42
 
@@ -53,6 +53,12 @@ with gr.Blocks(title=title) as demo:
53
  """)
54
  with gr.Tab("Features"):
55
  with gr.Row():
 
 
 
 
 
 
56
  with gr.Column():
57
  no_login = gr.Radio(["Yes", "No"],
58
  label="No Moodle login in last 7 days",
@@ -94,7 +100,7 @@ with gr.Blocks(title=title) as demo:
94
  lines=5,
95
  value=" ",
96
  )
97
- gr.Examples(["A machine learning prediction model was developed and the model predicted this student is at risk of failling the course. A list of data points will be given later, please analyze and explain the potential reasons for the student's success or failure. Be concise, reply under 200 words."], inputs=[ini_prompt])
98
  with gr.Column():
99
  revised_prompt = gr.Textbox(
100
  label="Revised Prompt",
@@ -113,7 +119,7 @@ with gr.Blocks(title=title) as demo:
113
  )
114
  text_ai_button = gr.Button("Generate Text")
115
 
116
- prompt_button.click(generate_prompt, inputs=[ini_prompt,no_login,low_activity,repeated_course,low_marks,WAM,forum_count,pre_fail,this_fail], outputs=[revised_prompt])
117
  text_ai_button.click(generate_ai_text, inputs=[revised_prompt,temperature], outputs=[genai_text], api_name="gen")
118
 
119
 
 
32
  text = response["choices"][0]["message"]["content"]
33
  return text
34
 
35
+ def generate_prompt(risk_category,ini_prompt,no_login,low_activity,repeated_course,low_marks,WAM,forum_count,pre_fail,this_fail):
36
 
37
  body = ini_prompt
38
 
39
+ data = f"The student is predicted to be '{risk_category}'\n Here are the indicators for the student:\n No Moodle Login: {no_login}\n Low Moodle Activity: {low_activity}\n Student is repeating this course: {repeated_course}\n Student has low marks: {low_marks}\n Student's WAM across all courses: {WAM}\n Student's forum activity: {forum_count}\n Count of student's previous fail of all courses: {pre_fail}\n Count of student's previous fail of this courses: {this_fail}\n "
40
 
41
  text = body + "\n\n" + data
42
 
 
53
  """)
54
  with gr.Tab("Features"):
55
  with gr.Row():
56
+ with gr.Column():
57
+ risk_category = gr.Radio(["May need urgent support", "May fall behind","On track"],
58
+ label="Prediction Status",
59
+ value="May need urgent support",
60
+ type="value"
61
+ )
62
  with gr.Column():
63
  no_login = gr.Radio(["Yes", "No"],
64
  label="No Moodle login in last 7 days",
 
100
  lines=5,
101
  value=" ",
102
  )
103
+ gr.Examples(["A machine learning prediction model was developed to predict student's academic performance for a course. A list of data points will be given later, please analyze and explain the potential reasons for the student's success or failure. Be concise, reply under 200 words."], inputs=[ini_prompt])
104
  with gr.Column():
105
  revised_prompt = gr.Textbox(
106
  label="Revised Prompt",
 
119
  )
120
  text_ai_button = gr.Button("Generate Text")
121
 
122
+ prompt_button.click(generate_prompt, inputs=[risk_category,ini_prompt,no_login,low_activity,repeated_course,low_marks,WAM,forum_count,pre_fail,this_fail], outputs=[revised_prompt])
123
  text_ai_button.click(generate_ai_text, inputs=[revised_prompt,temperature], outputs=[genai_text], api_name="gen")
124
 
125