QL2023 commited on
Commit
86abc04
·
verified ·
1 Parent(s): 6a3371e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -26
app.py CHANGED
@@ -4,17 +4,17 @@ import os
4
 
5
  address = os.getenv("address")
6
 
7
- def generate_message(prompt,temperature,todo,indcator_no_login,indcator_low_activity,indcator_repeated_course,indcator_low_marks):
8
 
9
  response = requests.post(address, json={
10
- "prompt":prompt,
11
- "temperature": temperature,
12
- "todo": todo,
13
-
14
- "indcator_no_login":indcator_no_login,
15
- "indcator_low_activity":indcator_low_activity,
16
- "indcator_repeated_course":indcator_repeated_course,
17
- "indcator_low_marks":indcator_low_marks
18
  }).json()
19
 
20
  result = response["body"]
@@ -26,7 +26,7 @@ title = "Message Generator Playground"
26
  with gr.Blocks(title=title) as demo:
27
  gr.Markdown("""
28
  # Message Generator Playground
29
- Select the conditions for a dummy student. Set a persona for the AI agent, then set a task for the agent. Default persona and task are editable.
30
  """)
31
  with gr.Tab("Options"):
32
  with gr.Row():
@@ -51,29 +51,24 @@ with gr.Blocks(title=title) as demo:
51
  value="No",
52
  type="value"
53
  )
54
- temperature = gr.Slider(0, 1, value=0.6, step=0.1,
55
- label="Temperature",
56
- info="Choose between 0 and 1"
57
- )
58
- with gr.Column():
59
- prompt = gr.Textbox(label="Persona",
60
- info="Persona of the AI agent",
61
- lines=10,
62
- value="Personality: You are an academic support AI helping professor writing message to student. You exhibit deep understanding of student challenges. You demonstrate knowledge of academic subjects and support pathways. You are approachable with and open and trustworthy demeanour. \n\n Communication style: You provide information that is straightforward and easy to understand. You use positive and encouraging language to motivate students who might be struggling. You apply a calm, patient and understanding tone to build trust and avoid creating panic. You show respect for different cultural backgrounds and foster an inclusive environment. Use British English spelling.",
63
  )
64
- todo = gr.Textbox(label="Task",
65
- info="Task for the AI agent",
66
- lines=5,
67
- value="Help me write a message for a student, I haven't seen him in class for a while.",
68
  )
69
  ai_button = gr.Button("Generate GenAI Message")
70
  with gr.Column():
71
  textlabel = gr.Textbox(label="Placeholder",lines=1,value="Your HTML message will be shown below:",)
72
  email_ai = gr.HTML(
73
  label="AI-generated Email",
74
- value="Depending on message content, please wait up to 5 mins, please scroll if message is long",
75
  )
76
 
77
- ai_button.click(generate_message, inputs=[prompt,temperature,todo,no_login,low_activity,repeated_course,low_marks], outputs=[email_ai])
78
 
79
- demo.launch()
 
4
 
5
  address = os.getenv("address")
6
 
7
+ def generate_message(indcator_no_login,indcator_low_activity,indcator_repeated_course,indcator_low_marks,indcator_low_wam,indcator_fail):
8
 
9
  response = requests.post(address, json={
10
+ "no_login":indcator_no_login,
11
+ "low_activity":indcator_low_activity,
12
+ "repeated_course":indcator_repeated_course,
13
+ "low_marks":indcator_low_marks,
14
+ "low_wam": indcator_low_wam,
15
+ "fail": indcator_fail,
16
+ "prediction": "",
17
+ "additional_info": "",
18
  }).json()
19
 
20
  result = response["body"]
 
26
  with gr.Blocks(title=title) as demo:
27
  gr.Markdown("""
28
  # Message Generator Playground
29
+ Select the conditions for a dummy student.
30
  """)
31
  with gr.Tab("Options"):
32
  with gr.Row():
 
51
  value="No",
52
  type="value"
53
  )
54
+ low_wam = gr.Radio(["Yes", "No"],
55
+ label="Low WAM",
56
+ value="No",
57
+ type="value"
 
 
 
 
 
58
  )
59
+ fails = gr.Radio(["Yes", "No"],
60
+ label="Failed other course previously",
61
+ value="No",
62
+ type="value"
63
  )
64
  ai_button = gr.Button("Generate GenAI Message")
65
  with gr.Column():
66
  textlabel = gr.Textbox(label="Placeholder",lines=1,value="Your HTML message will be shown below:",)
67
  email_ai = gr.HTML(
68
  label="AI-generated Email",
69
+ value="Depending on message content, please wait up to 1 mins, please scroll if message is long",
70
  )
71
 
72
+ ai_button.click(generate_message, inputs=[no_login,low_activity,repeated_course,low_marks,low_wam,fails], outputs=[email_ai])
73
 
74
+ demo.launch()