Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,7 +32,14 @@ def generate_ai_text(prompt,temperature):
|
|
| 32 |
text = response["choices"][0]["message"]["content"]
|
| 33 |
return text
|
| 34 |
|
|
|
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
############################
|
| 37 |
|
| 38 |
title = "Explainer v0.1"
|
|
@@ -82,7 +89,7 @@ with gr.Blocks(title=title) as demo:
|
|
| 82 |
lines=5,
|
| 83 |
value=" ",
|
| 84 |
)
|
| 85 |
-
gr.Examples(["A prediction model was developed
|
| 86 |
with gr.Column():
|
| 87 |
revised_prompt = gr.Textbox(
|
| 88 |
label="Revised Prompt",
|
|
@@ -99,7 +106,7 @@ with gr.Blocks(title=title) as demo:
|
|
| 99 |
)
|
| 100 |
text_ai_button = gr.Button("Generate Text")
|
| 101 |
|
| 102 |
-
prompt_button.click(generate_prompt, inputs=[no_login,low_activity,repeated_course,low_marks,WAM], outputs=[revised_prompt])
|
| 103 |
text_ai_button.click(generate_ai_text, inputs=[revised_prompt,temperature], outputs=[genai_text], api_name="gen")
|
| 104 |
|
| 105 |
|
|
|
|
| 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):
|
| 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"
|
| 40 |
+
|
| 41 |
+
return text
|
| 42 |
+
|
| 43 |
############################
|
| 44 |
|
| 45 |
title = "Explainer v0.1"
|
|
|
|
| 89 |
lines=5,
|
| 90 |
value=" ",
|
| 91 |
)
|
| 92 |
+
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."], inputs=[ini_prompt])
|
| 93 |
with gr.Column():
|
| 94 |
revised_prompt = gr.Textbox(
|
| 95 |
label="Revised Prompt",
|
|
|
|
| 106 |
)
|
| 107 |
text_ai_button = gr.Button("Generate Text")
|
| 108 |
|
| 109 |
+
prompt_button.click(generate_prompt, inputs=[ini_prompt,no_login,low_activity,repeated_course,low_marks,WAM], outputs=[revised_prompt])
|
| 110 |
text_ai_button.click(generate_ai_text, inputs=[revised_prompt,temperature], outputs=[genai_text], api_name="gen")
|
| 111 |
|
| 112 |
|