import gradio as gr from huggingface_hub import InferenceClient import pandas as pd # df = pd.read_csv("Diemthi2024_processed.csv") def respond( sbd, khoi ): # score = df[df['sbd_str'] == sbd] # count_all = (df[khoi] > score[khoi].iloc[0]).sum() # count_kv = ((df[khoi] > score[khoi].iloc[0]) & (df['kv'] == score['kv'].iloc[0])).sum() # count_tinh = ((df[khoi] > score[khoi].iloc[0]) & (df['tinh'] == score['tinh'].iloc[0])).sum() count_all = 0 count_kv = 0 count_tinh = 0 return f""" National Ranking: {count_all} Regional Ranking: {count_kv} Provincal Ranking: {count_tinh}""" """ Chatbot """ with gr.Blocks() as demo: gr.Markdown( """ National Graduation Exam Score Ranking

Input your ID and your combination:

""" ) with gr.Row(): id = gr.Textbox(placeholder="Input your ID", label="", lines=1) comb = gr.Dropdown( ["A00", "A01", "B00", "C00", "C03", "D01", "D07"], label="Combination", info="Will add more combinations later!" ) with gr.Row(): check_button = gr.Button("Rank now!", variant="primary") out = gr.Textbox(label="OUTPUT", placeholder="", lines=2) check_button.click(fn=respond, inputs=[id,comb], outputs=out) if __name__ == "__main__": demo.launch()