arunasrivastava commited on
Commit
18825b7
·
1 Parent(s): d0d1794

static functions

Browse files
Files changed (1) hide show
  1. app.py +27 -27
app.py CHANGED
@@ -37,34 +37,34 @@ def format_leaderboard_df(df):
37
 
38
  return display_df.sort_values("Average PER ⬇️")
39
 
40
- def submit_evaluation(model_name, submission_name, github_url):
41
- if not model_name or not submission_name:
42
- return "⚠️ Please provide both model name and submission name."
43
 
44
- request_data = {
45
- "transcription_model": model_name,
46
- "subset": "test",
47
- "submission_name": submission_name,
48
- "github_url": github_url if github_url else None
49
- }
50
 
51
- try:
52
- response = requests.post(f"{BACKEND_URL}/evaluate", json=request_data)
53
- response.raise_for_status()
54
- task_id = response.json()["task_id"]
55
- return f"✅ Evaluation submitted successfully! Task ID: {task_id}"
56
- except requests.RequestException as e:
57
- return f"❌ Error: {str(e)}"
58
 
59
- def check_task_status(task_id):
60
- if not task_id:
61
- return "Please enter a task ID"
62
- try:
63
- response = requests.get(f"{BACKEND_URL}/tasks/{task_id}")
64
- response.raise_for_status()
65
- return response.json()
66
- except requests.RequestException as e:
67
- return f"Error checking status: {str(e)}"
68
 
69
  def create_html_table(df):
70
  return df.to_html(escape=False, index=False, classes="styled-table")
@@ -113,7 +113,7 @@ with gr.Blocks(css="""
113
  result = gr.Textbox(label="Submission Status")
114
 
115
  submit_btn.click(
116
- submit_evaluation,
117
  inputs=[model_name, submission_name, github_url],
118
  outputs=result
119
  )
@@ -124,7 +124,7 @@ with gr.Blocks(css="""
124
  status_output = gr.JSON(label="Status")
125
 
126
  status_btn.click(
127
- check_task_status,
128
  inputs=task_id,
129
  outputs=status_output
130
  )
 
37
 
38
  return display_df.sort_values("Average PER ⬇️")
39
 
40
+ # def submit_evaluation(model_name, submission_name, github_url):
41
+ # if not model_name or not submission_name:
42
+ # return "⚠️ Please provide both model name and submission name."
43
 
44
+ # request_data = {
45
+ # "transcription_model": model_name,
46
+ # "subset": "test",
47
+ # "submission_name": submission_name,
48
+ # "github_url": github_url if github_url else None
49
+ # }
50
 
51
+ # try:
52
+ # response = requests.post(f"{BACKEND_URL}/evaluate", json=request_data)
53
+ # response.raise_for_status()
54
+ # task_id = response.json()["task_id"]
55
+ # return f"✅ Evaluation submitted successfully! Task ID: {task_id}"
56
+ # except requests.RequestException as e:
57
+ # return f"❌ Error: {str(e)}"
58
 
59
+ # def check_task_status(task_id):
60
+ # if not task_id:
61
+ # return "Please enter a task ID"
62
+ # try:
63
+ # response = requests.get(f"{BACKEND_URL}/tasks/{task_id}")
64
+ # response.raise_for_status()
65
+ # return response.json()
66
+ # except requests.RequestException as e:
67
+ # return f"Error checking status: {str(e)}"
68
 
69
  def create_html_table(df):
70
  return df.to_html(escape=False, index=False, classes="styled-table")
 
113
  result = gr.Textbox(label="Submission Status")
114
 
115
  submit_btn.click(
116
+ # submit_evaluation,
117
  inputs=[model_name, submission_name, github_url],
118
  outputs=result
119
  )
 
124
  status_output = gr.JSON(label="Status")
125
 
126
  status_btn.click(
127
+ # check_task_status,
128
  inputs=task_id,
129
  outputs=status_output
130
  )