Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import numpy as np | |
| def calculate_point(n_teammates, rank, n_teams, t): | |
| point = ( | |
| (100000 / (n_teammates) ** 0.5) | |
| * ((rank) ** -0.75) | |
| * np.log10(1 + np.log10(n_teams)) | |
| * np.exp(-1 * t / 500) | |
| ) | |
| return point | |
| def gradio_calculate_point(n_teammates, rank, n_teams, t): | |
| points = calculate_point(n_teammates, rank, n_teams, t) | |
| return f"Points: {int(points)}" | |
| with gr.Blocks(title="Kaggle Points", theme=gr.themes.Ocean()) as demo: | |
| gr.Markdown("# ๐ Kaggle Competition Points Calculator") | |
| gr.Markdown( | |
| "Calculate your Kaggle competition points based on team size, rank, total number of teams, and time elapsed." | |
| ) | |
| with gr.Row(): | |
| with gr.Column(scale=1): | |
| n_teammates = gr.Number(label="๐ฅ Number of Teammates", value=1, minimum=1) | |
| rank = gr.Number(label="๐ฅ Final Rank", value=1, minimum=1) | |
| n_teams = gr.Number(label="๐ Total Number of Teams", value=1000, minimum=1) | |
| t = gr.Number(label="โฑ๏ธ Time Elapsed (days)", value=0, minimum=0) | |
| with gr.Column(scale=1): | |
| calculate_btn = gr.Button( | |
| "๐งฎ Calculate Points", variant="primary", size="lg" | |
| ) | |
| output = gr.Textbox(label="๐ Your Points", interactive=False, lines=2) | |
| calculate_btn.click( | |
| gradio_calculate_point, inputs=[n_teammates, rank, n_teams, t], outputs=output | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch() | |