Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -95,19 +95,26 @@ mapping_note_vi = {
|
|
95 |
"Lễ phép với thầy cô": "Lễ phép với thầy cô",
|
96 |
}
|
97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
def gen_english(*args):
|
99 |
input_dict = {
|
100 |
'title': "Cô" if args[0] == "Female teacher" else "Thầy" if args[0] else None,
|
101 |
-
|
102 |
-
'
|
103 |
-
'
|
104 |
-
'
|
105 |
-
'
|
106 |
-
'
|
107 |
-
'
|
108 |
-
'
|
109 |
-
'
|
110 |
-
'
|
|
|
111 |
}
|
112 |
response = send_request_english(input_dict)
|
113 |
return response["evaluation"].replace("**", '"')
|
@@ -115,13 +122,14 @@ def gen_english(*args):
|
|
115 |
def gen_math(*args):
|
116 |
input_dict = {
|
117 |
'title': "Cô" if args[0] == "Cô giáo" else "Thầy" if args[0] else None,
|
118 |
-
|
119 |
-
'
|
120 |
-
'
|
121 |
-
'
|
122 |
-
'
|
123 |
-
'
|
124 |
-
'
|
|
|
125 |
}
|
126 |
response = send_request_math(input_dict)
|
127 |
return response["evaluation"].replace("**", '"')
|
@@ -149,10 +157,15 @@ with gr.Blocks() as demo:
|
|
149 |
with gr.Row():
|
150 |
# --- Nhóm các thành phần nhập liệu ---
|
151 |
with gr.Column():
|
152 |
-
with gr.
|
153 |
-
|
154 |
-
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
156 |
with gr.Group():
|
157 |
review += [
|
158 |
gr.Radio(["1 - Poor","2 - Average","3 - Good","4 - Very Good","5 - Excellent"], value="3 - Good", label="Learning ability", show_label=True),
|
@@ -200,10 +213,15 @@ with gr.Blocks() as demo:
|
|
200 |
with gr.Row():
|
201 |
# --- Nhóm các thành phần nhập liệu ---
|
202 |
with gr.Column():
|
203 |
-
with gr.
|
204 |
-
|
205 |
-
|
206 |
-
|
|
|
|
|
|
|
|
|
|
|
207 |
with gr.Group():
|
208 |
review += [
|
209 |
gr.Radio(["1 - Yếu","2 - Trung bình","3 - Khá","4 - Tốt","5 - Tuyệt vời"], value="3 - Khá", label="Khả năng tiếp thu", show_label=True),
|
|
|
95 |
"Lễ phép với thầy cô": "Lễ phép với thầy cô",
|
96 |
}
|
97 |
|
98 |
+
mapping_style_en = {
|
99 |
+
"Close, friendly": "Gần gũi, thân thiện",
|
100 |
+
"Short, concise": "Ngắn gọn, xúc tích",
|
101 |
+
"Emotions": "Nhiều cảm xúc",
|
102 |
+
}
|
103 |
+
|
104 |
def gen_english(*args):
|
105 |
input_dict = {
|
106 |
'title': "Cô" if args[0] == "Female teacher" else "Thầy" if args[0] else None,
|
107 |
+
'style': mapping_style_en.get(args[1]) if args[1] else None,
|
108 |
+
'reception': mapping_score_en.get(args[2]) if args[2] else None,
|
109 |
+
'participate_activities': mapping_score_en.get(args[3]) if args[3] else None,
|
110 |
+
'remember_apply_vocab_grama': mapping_score_en.get(args[4]) if args[4] else None,
|
111 |
+
'note': [mapping_note_en.get(x) for x in args[5]] if len(args[5])!= 0 else [],
|
112 |
+
'pronounce': mapping_score_en.get(args[6]) if args[6] else None,
|
113 |
+
'remember_apply_strategies': mapping_score_en.get(args[7]) if args[7] else None,
|
114 |
+
'vocabulary_need_improve': args[8] if args[8] else "",
|
115 |
+
'grammar_need_improve': args[9] if args[9] else "",
|
116 |
+
'exercise_need_improve': args[10] if args[10] else "",
|
117 |
+
'note_for_skills': args[11] if args[11] else "",
|
118 |
}
|
119 |
response = send_request_english(input_dict)
|
120 |
return response["evaluation"].replace("**", '"')
|
|
|
122 |
def gen_math(*args):
|
123 |
input_dict = {
|
124 |
'title': "Cô" if args[0] == "Cô giáo" else "Thầy" if args[0] else None,
|
125 |
+
'style': args[1].lower() if args[1] else None,
|
126 |
+
'reception': mapping_score_vi.get(args[2]) if args[2] else None,
|
127 |
+
'exercise_format_understanding': args[3] if args[3] else "",
|
128 |
+
'exercise_format_not_understanding': args[4] if args[4] else "",
|
129 |
+
'more_evaluations': args[5] if args[5] else "",
|
130 |
+
'participate_activities': mapping_score_vi.get(args[6]) if args[6] else None,
|
131 |
+
'problem_solving_and_presentation': mapping_score_vi.get(args[7]) if args[7] else None,
|
132 |
+
'note': [mapping_note_vi.get(x) for x in args[8]] if args[8] else [],
|
133 |
}
|
134 |
response = send_request_math(input_dict)
|
135 |
return response["evaluation"].replace("**", '"')
|
|
|
157 |
with gr.Row():
|
158 |
# --- Nhóm các thành phần nhập liệu ---
|
159 |
with gr.Column():
|
160 |
+
with gr.Row():
|
161 |
+
with gr.Group():
|
162 |
+
review = [
|
163 |
+
gr.Radio(["Female teacher", "Male teacher"], value="Female teacher", label="I am a", show_label=True),
|
164 |
+
]
|
165 |
+
with gr.Group():
|
166 |
+
review += [
|
167 |
+
gr.Radio(["Close, friendly", "Short, concise", "Emotions"], value="Close, friendly", label="Evaluative Tone", show_label=True),
|
168 |
+
]
|
169 |
with gr.Group():
|
170 |
review += [
|
171 |
gr.Radio(["1 - Poor","2 - Average","3 - Good","4 - Very Good","5 - Excellent"], value="3 - Good", label="Learning ability", show_label=True),
|
|
|
213 |
with gr.Row():
|
214 |
# --- Nhóm các thành phần nhập liệu ---
|
215 |
with gr.Column():
|
216 |
+
with gr.Row():
|
217 |
+
with gr.Group():
|
218 |
+
review = [
|
219 |
+
gr.Radio(["Cô giáo", "Thầy giáo"], value="Cô giáo", label="Bạn là", show_label=True),
|
220 |
+
]
|
221 |
+
with gr.Group():
|
222 |
+
review += [
|
223 |
+
gr.Radio(["Gần gũi, thân thiện", "Ngắn gọn, xúc tích", "Nhiều cảm xúc"], value="Gần gũi, thân thiện", label="Giọng văn đánh giá", show_label=True),
|
224 |
+
]
|
225 |
with gr.Group():
|
226 |
review += [
|
227 |
gr.Radio(["1 - Yếu","2 - Trung bình","3 - Khá","4 - Tốt","5 - Tuyệt vời"], value="3 - Khá", label="Khả năng tiếp thu", show_label=True),
|