quocvuong82 commited on
Commit
2fd4a04
·
verified ·
1 Parent(s): badc801

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -41
app.py DELETED
@@ -1,41 +0,0 @@
1
- import json
2
- import gradio as gr
3
- import pandas as pd
4
-
5
- # Đọc dữ liệu từ file JSON
6
- with open('Diemthi2024_processed_csl.json', 'r', encoding='utf-8') as file:
7
- data = json.load(file)
8
-
9
- # Hàm tra cứu điểm thi
10
- def tra_cuu_diem_thi(sbd):
11
- if sbd in data:
12
- ket_qua = data[sbd]
13
- diem_thi = ket_qua["Điểm thi"]
14
- to_hop_list = ket_qua["Tổ hợp"]
15
- # to_hop_strs = []
16
- # for ma, diem, diem_ut, th_tt, th_tq in to_hop_list:
17
- # to_hop_strs.append(f"{ma}: {diem} điểm ({diem_ut} điểm - có tính điểm Ưu tiên), {th_tt}, th_tq")
18
- # to_hop_str = '\n'.join(to_hop_strs)
19
- # df = pd.DataFrame(to_hop_strs, columns=['Các tổ hợp điểm'])
20
- tab = []
21
- for ma, diem, diem_ut, th_tt, th_tq in to_hop_list:
22
- tab.append([ma, f"{diem:0.2f}", f"{diem_ut:0.2f}", th_tt.split(":")[-1].strip(), th_tq.split(":")[-1].strip()])
23
- df = pd.DataFrame(tab, columns=['Mã tổ hợp', "Điểm không ƯT", "Điểm có ƯT", "Thứ hạng Tỉnh", "Thứ hạng TQ"])
24
- return f"**Điểm các môn thi:**\n\n## {diem_thi}", df
25
- else:
26
- return "Không tìm thấy kết quả cho SBD này.", None
27
-
28
- # Tạo giao diện Gradio
29
- with gr.Blocks() as demo:
30
- gr.Markdown("# Tra cứu điểm thi TN 2024 (Trường THPT Chuyên - Tỉnh Sơn La)")
31
-
32
- sbd_input = gr.Textbox(label="Nhập SBD")
33
- tra_cuu_btn = gr.Button("Tra cứu")
34
- # out_diem = gr.Textbox(label="Điểm các môn thi", elem_classes="large-font")
35
- out_diem = gr.Markdown(label="Điềm các môn thi")
36
- out_tohop = gr.DataFrame(label="Các tổ hợp xét tuyển", col_count=(5, "fixed"), row_count=(15, "fixed"))
37
-
38
- tra_cuu_btn.click(tra_cuu_diem_thi, inputs=sbd_input, outputs=[out_diem, out_tohop])
39
-
40
- # Chạy ứng dụng
41
- demo.launch()