| import gradio as gr | |
| def calculate_class_multiplier(class_name): | |
| if class_name == "E": | |
| return 0.2 | |
| elif class_name == "D": | |
| return 0.4 | |
| elif class_name == "C": | |
| return 0.5 | |
| elif class_name == "B": | |
| return 0.8 | |
| elif class_name == "A": | |
| return 1.0 | |
| else: print("Error: Class name is not valid") | |
| def calculate_participant_multiplier(participant_amount): | |
| if participant_amount <= 3: | |
| return -0.5 | |
| elif participant_amount <= 6: | |
| return -0.25 | |
| elif participant_amount <= 12: | |
| return -0.10 | |
| elif participant_amount <= 24: | |
| return 0.10 | |
| elif participant_amount <= 48: | |
| return 0.25 | |
| elif participant_amount <= 96: | |
| return 0.30 | |
| else: print("Error: Dans sporuna bak bee nerelere gelmiş (gelmez)") | |
| def calculate_team_multiplier(team_amount): | |
| if team_amount <= 4: | |
| return 0 | |
| elif team_amount <= 8: | |
| return 0.10 | |
| elif team_amount <= 12: | |
| return 0.15 | |
| elif team_amount <= 30: | |
| return 0.20 | |
| else: print("Error: Hepimiz dağılıp takım mı kurduk da böyle oldu ki?") | |
| def calculate_judge_multiplier(judge_amount): | |
| if judge_amount == 5: | |
| return 0 | |
| elif judge_amount == 7: | |
| return 0.05 | |
| elif judge_amount == 9: | |
| return 0.10 | |
| elif judge_amount == 11: | |
| return 0.15 | |
| elif judge_amount == 13: | |
| return 0.20 | |
| else: print("Error: Judge amount is not valid") | |
| def placement_point_calculator(placement): | |
| if placement == 1: | |
| return 320 | |
| elif placement == 2: | |
| return 300 | |
| elif placement == 3: | |
| return 280 | |
| elif placement == 4: | |
| return 260 | |
| elif placement == 5: | |
| return 240 | |
| elif placement == 6: | |
| return 220 | |
| elif placement == 7: | |
| return 200 | |
| elif placement == 8: | |
| return 180 | |
| elif placement == 9: | |
| return 160 | |
| elif placement == 10: | |
| return 140 | |
| elif placement == 11: | |
| return 120 | |
| elif placement == 12: | |
| return 100 | |
| elif placement == 13: | |
| return 96 | |
| elif placement == 14: | |
| return 92 | |
| elif placement == 15: | |
| return 88 | |
| elif placement == 16: | |
| return 84 | |
| elif placement == 17: | |
| return 80 | |
| elif placement == 18: | |
| return 78 | |
| elif placement == 19: | |
| return 76 | |
| elif placement == 20: | |
| return 74 | |
| elif placement == 21: | |
| return 72 | |
| elif placement == 22: | |
| return 60 | |
| elif placement == 23: | |
| return 56 | |
| elif placement == 24: | |
| return 52 | |
| elif placement <=30: | |
| return 48 | |
| elif placement <=36: | |
| return 44 | |
| elif placement <=42: | |
| return 40 | |
| elif placement <=48: | |
| return 36 | |
| elif placement <=96: | |
| return 16 | |
| else: print("Error: Abartma reyiz") | |
| def calculate_point(Klasman, Çift_Sayısı, Klüp_Sayısı, Hakem_Sayısı, Sıralama): | |
| class_multiplier = calculate_class_multiplier(Klasman) | |
| participant_multiplier = calculate_participant_multiplier(Çift_Sayısı) | |
| team_multiplier = calculate_team_multiplier(Klüp_Sayısı) | |
| judge_multiplier = calculate_judge_multiplier(Hakem_Sayısı) | |
| placement_point = placement_point_calculator(Sıralama) | |
| return (placement_point * class_multiplier) * (1 + participant_multiplier + team_multiplier + judge_multiplier) | |
| iface = gr.Interface( | |
| fn=calculate_point, | |
| inputs=["text", "number", "number", "number", "number"], | |
| outputs="text", | |
| live=False, | |
| title="Hocam Klasman Atlamışım", | |
| description="", | |
| ) | |
| iface.launch() |