oddadmix commited on
Commit
fc57e2d
Β·
verified Β·
1 Parent(s): 6f2f386

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +80 -23
app.py CHANGED
@@ -9,20 +9,21 @@ HF_TOKEN = os.getenv("HF_TOKEN")
9
  SUBMISSIONS_REPO = "oddadmix/ocr-competition-submissions"
10
  RESULTS_REPO = "oddadmix/ocr-competition-results"
11
 
12
- def validate_fields(team_name, email, model_name, hf_model_id, hf_token):
13
  # Check if any field is empty
14
- if not team_name or not email or not model_name or not hf_model_id or not hf_token:
15
  return "All fields are required. Please fill in all fields."
16
  # Proceed with submission if all fields are filled
17
- return submit(team_name, email, model_name, hf_model_id, hf_token)
18
 
19
- def submit(team_name, email, model_name, hf_model_id, hf_token):
20
  entry = {
21
  "team_name": team_name,
22
  "email": email,
23
  "model_name": model_name,
24
  "hf_model_id": hf_model_id,
25
- "hf_token": hf_token
 
26
  }
27
  filename = f"{team_name}_{model_name}_{pd.Timestamp.now().strftime('%Y%m%d%H%M%S')}.json"
28
  with open(filename, "w") as f:
@@ -47,22 +48,78 @@ def show_results():
47
  return f"An error occurred while loading the results: {e}"
48
 
49
  with gr.Blocks() as demo:
50
- gr.Markdown("# VLM OCR Competition Submission")
51
-
52
- with gr.Row():
53
- team = gr.Textbox(label="Team Name")
54
- email = gr.Textbox(label="Email")
55
- model = gr.Textbox(label="Model Name")
56
- hf_model = gr.Textbox(label="Hugging Face Model ID")
57
- hf_token = gr.Textbox(label="Hugging Face Access Token", type="password")
58
-
59
- submit_btn = gr.Button("Submit")
60
- status = gr.Textbox(label="Status")
61
-
62
- submit_btn.click(fn=validate_fields, inputs=[team, email, model, hf_model, hf_token], outputs=status)
63
-
64
- gr.Markdown("## Leaderboard Results")
65
- results = gr.Dataframe(headers=["model_name", "WER", "CER", "BLEU", "team_name"])
66
- demo.load(fn=show_results, outputs=results)
67
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  demo.launch()
 
9
  SUBMISSIONS_REPO = "oddadmix/ocr-competition-submissions"
10
  RESULTS_REPO = "oddadmix/ocr-competition-results"
11
 
12
+ def validate_fields(team_name, email, model_name, hf_model_id, hf_token, code):
13
  # Check if any field is empty
14
+ if not team_name or not email or not model_name or not hf_model_id or not hf_token or not code:
15
  return "All fields are required. Please fill in all fields."
16
  # Proceed with submission if all fields are filled
17
+ return submit(team_name, email, model_name, hf_model_id, hf_token, code)
18
 
19
+ def submit(team_name, email, model_name, hf_model_id, hf_token, code):
20
  entry = {
21
  "team_name": team_name,
22
  "email": email,
23
  "model_name": model_name,
24
  "hf_model_id": hf_model_id,
25
+ "hf_token": hf_token,
26
+ "code": code
27
  }
28
  filename = f"{team_name}_{model_name}_{pd.Timestamp.now().strftime('%Y%m%d%H%M%S')}.json"
29
  with open(filename, "w") as f:
 
48
  return f"An error occurred while loading the results: {e}"
49
 
50
  with gr.Blocks() as demo:
51
+ gr.Markdown("# πŸ† VLM OCR Competition")
52
+
53
+ with gr.Tabs():
54
+ with gr.Tab("πŸ“œ Rules"):
55
+ gr.Markdown("""
56
+ ## Competition Rules
57
+ - Each team can submit **one model evaluation per week**.
58
+ - The competition runs from **September 12 to October 12** (1 month).
59
+ - The evaluation dataset will **not be provided** to participants.
60
+ - Teams must submit:
61
+ 1. Their Hugging Face Model ID.
62
+ 2. A valid Hugging Face token with access.
63
+ 3. The code required to run the model.
64
+ - **Team name must remain the same across all submissions.**
65
+
66
+ ---
67
+ ### Sponsored & Organized By
68
+ <div style="display:flex; align-items:center; gap:20px;">
69
+ <div>
70
+ <a href="https://www.linkedin.com/company/68577545" target="_blank">
71
+ <img src="https://kand.ca/logo.png" alt="KANDCA" width="180"/>
72
+ </a>
73
+ <p><b>KANDCA</b> – Sponsor</p>
74
+ </div>
75
+ <div>
76
+ <img src="https://kand.nyc3.cdn.digitaloceanspaces.com/namaa/namaa-logo.png" alt="NAMAA Community" width="180"/>
77
+ <p><b>NAMAA Community</b> – Organizer</p>
78
+ </div>
79
+ </div>
80
+ """)
81
+
82
+ with gr.Tab("🎁 Prizes"):
83
+ gr.Markdown("""
84
+ ## Prize Distribution
85
+ - **1st Place:** πŸ₯‡ 250 USD (bank transfer or API credits)
86
+ - **2nd Place:** πŸ₯ˆ 125 USD
87
+ - **3rd Place:** πŸ₯‰ 75 USD
88
+ - **4th Place:** πŸŽ–οΈ 50 USD
89
+ - **5th Place:** πŸŽ–οΈ 25 USD
90
+ """)
91
+
92
+ with gr.Tab("πŸ“Š Evaluation"):
93
+ gr.Markdown("""
94
+ ## Evaluation Details
95
+ - The evaluation dataset will remain **private**.
96
+ - It will include:
97
+ - Historical documents
98
+ - Scanned pages
99
+ - Different layouts
100
+ - Handwritten pages
101
+ - Models will be evaluated on **accuracy metrics** such as WER, CER, and BLEU.
102
+ """)
103
+
104
+ with gr.Tab("πŸš€ Submit & Leaderboard"):
105
+ gr.Markdown("### Submit Your Model")
106
+ with gr.Row():
107
+ team = gr.Textbox(label="Team Name")
108
+ email = gr.Textbox(label="Email")
109
+ model = gr.Textbox(label="Model Name")
110
+ hf_model = gr.Textbox(label="Hugging Face Model ID")
111
+ hf_token = gr.Textbox(label="Hugging Face Access Token", type="password")
112
+ code = gr.Textbox(label="Code (instructions to run your model)", lines=6, placeholder="Paste your run code here...")
113
+
114
+ submit_btn = gr.Button("Submit")
115
+ status = gr.Textbox(label="Status")
116
+
117
+ submit_btn.click(fn=validate_fields,
118
+ inputs=[team, email, model, hf_model, hf_token, code],
119
+ outputs=status)
120
+
121
+ gr.Markdown("### Leaderboard Results")
122
+ results = gr.Dataframe(headers=["model_name", "WER", "CER", "BLEU", "team_name"])
123
+ demo.load(fn=show_results, outputs=results)
124
+
125
  demo.launch()