ngocminhta commited on
Commit
33c8dfc
1 Parent(s): a69aa04

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -10
app.py CHANGED
@@ -2,21 +2,17 @@ import gradio as gr
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_str'] == 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
- count_all = 0
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}"""