ngocminhta
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -2,21 +2,17 @@ import gradio as gr
|
|
2 |
from huggingface_hub import InferenceClient
|
3 |
import pandas as pd
|
4 |
|
5 |
-
|
6 |
|
7 |
def respond(
|
8 |
sbd, khoi
|
9 |
):
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
|
15 |
-
|
16 |
-
count_kv = 0
|
17 |
-
count_tinh = 0
|
18 |
-
|
19 |
-
return f"""
|
20 |
National Ranking: {count_all}
|
21 |
Regional Ranking: {count_kv}
|
22 |
Provincal Ranking: {count_tinh}"""
|
|
|
2 |
from huggingface_hub import InferenceClient
|
3 |
import pandas as pd
|
4 |
|
5 |
+
df = pd.read_csv("Diemthi2024_processed.csv")
|
6 |
|
7 |
def respond(
|
8 |
sbd, khoi
|
9 |
):
|
10 |
+
score = df[df['sbd'] == int(sbd)]
|
11 |
+
count_all = (df[khoi] >= score[khoi].iloc[0]).sum()
|
12 |
+
count_kv = ((df[khoi] >= score[khoi].iloc[0]) & (df['kv'] == score['kv'].iloc[0])).sum()
|
13 |
+
count_tinh = ((df[khoi] >= score[khoi].iloc[0]) & (df['tinh'] == score['tinh'].iloc[0])).sum()
|
14 |
|
15 |
+
return f"""Your score is {score[khoi].iloc[0]}
|
|
|
|
|
|
|
|
|
16 |
National Ranking: {count_all}
|
17 |
Regional Ranking: {count_kv}
|
18 |
Provincal Ranking: {count_tinh}"""
|