ngocminhta commited on
Commit
8473d93
·
verified ·
1 Parent(s): 52e31c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -13,10 +13,10 @@ def respond(
13
  count_kv = ((df[khoi] >= score[khoi].iloc[0]) & (df['kv'] == score['kv'].iloc[0])).sum()
14
  count_tinh = ((df[khoi] >= score[khoi].iloc[0]) & (df['tinh'] == score['tinh'].iloc[0])).sum()
15
 
16
- return f"""Your score is {score[khoi].iloc[0]}
17
- National Ranking: {count_all}
18
- Regional Ranking: {count_kv}
19
- Provincal Ranking: {count_tinh}"""
20
 
21
  """
22
  Chatbot
@@ -42,22 +42,23 @@ with gr.Blocks() as demo:
42
  font-size: 16px;
43
  }
44
  </style>
45
- <span style='font-family: Arial, sans-serif; font-size: 20px;'>National Graduation Exam Score Ranking</span>
46
- <p style='font-family: Arial, sans-serif;'>Input your ID and your combination:</p>
47
  """
48
  )
49
  with gr.Row():
50
- id = gr.Textbox(placeholder="Input your ID", label="Input your ID:", lines=1)
51
  comb = gr.Dropdown(
52
- ["A00", "A01", "B00", "C00", "C03", "D01", "D07"], label="Select your Combination:", info="Will add more combinations later!"
53
  )
54
 
55
  with gr.Row():
56
- check_button = gr.Button("Rank now!", variant="primary")
57
 
58
- out = gr.Textbox(label="OUTPUT", placeholder="", lines=2)
 
59
 
60
- check_button.click(fn=respond, inputs=[id,comb], outputs=out)
61
 
62
  if __name__ == "__main__":
63
  demo.launch()
 
13
  count_kv = ((df[khoi] >= score[khoi].iloc[0]) & (df['kv'] == score['kv'].iloc[0])).sum()
14
  count_tinh = ((df[khoi] >= score[khoi].iloc[0]) & (df['tinh'] == score['tinh'].iloc[0])).sum()
15
 
16
+ return f"""Tổng điểm theo khối {khoi} của bạn là: {score[khoi].iloc[0]}
17
+ Thứ hạng toàn quốc: {count_all}
18
+ Thứ hạng theo khu vực: {count_kv}
19
+ Thứ hạng theo tỉnh: {count_tinh}""", scoredf.iloc[:, 1:10]
20
 
21
  """
22
  Chatbot
 
42
  font-size: 16px;
43
  }
44
  </style>
45
+ <span style='font-family: Arial, sans-serif; font-size: 20px;'>Xếp hạng điểm thi Tốt nghiệp THPT 2024</span>
46
+ <p style='font-family: Arial, sans-serif;'>Nhập số báo danh lựa chọn tổ hợp của bạn bên dưới</p>
47
  """
48
  )
49
  with gr.Row():
50
+ id = gr.Textbox(placeholder="Nhập SBD của bạn", label="Nhập SBD của bạn:", lines=1)
51
  comb = gr.Dropdown(
52
+ ["A00","A01","A02","A03","A04","A05","A06","A07","A08","A09","A10","A11","A12","A14","A15","A16","A17","A18","B00","B01","B02","B03","B04","B05","B08","C00","C01","C02","C03","C04","C05","C06","C07","C08","C09","C10","C12","C13","C14","C15","C16","C17","C18","C19","C20","D01","D07","D08","D09","D10","D11","D12","D13","D14","D15","D66","D72","D78","D84","D90","D96"], label="Chọn tổ hợp của bạn:", info="Đang cập nhật thêm các tổ hợp..."
53
  )
54
 
55
  with gr.Row():
56
+ check_button = gr.Button("Tra cứu!", variant="primary")
57
 
58
+ df = gr.DataFrame(label="Điểm thi", col_count=(9, "fixed"))
59
+ out = gr.Textbox(label="Xếp hạng", placeholder="", lines=2)
60
 
61
+ check_button.click(fn=respond, inputs=[id,comb], outputs=[out,df])
62
 
63
  if __name__ == "__main__":
64
  demo.launch()