eduardo-alvarez commited on
Commit
2c70658
β€’
1 Parent(s): 45a5cfd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -2
app.py CHANGED
@@ -28,6 +28,7 @@ from info.about import(
28
  from src.processing import filter_benchmarks_table
29
 
30
  inference_endpoint_url = os.environ['inference_endpoint_url']
 
31
  inference_concurrency_limit = os.environ['inference_concurrency_limit']
32
 
33
  demo = gr.Blocks()
@@ -45,6 +46,33 @@ with demo:
45
  gr.Markdown("""A special shout-out to the πŸ€— [Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)
46
  team for generously sharing their code and best
47
  practices, ensuring that AI Developers have a valuable and enjoyable tool at their disposal.""")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
  with gr.Accordion("Chat with Top Models on the Leaderboard Here πŸ’¬", open=False):
50
 
@@ -210,7 +238,12 @@ with demo:
210
  interactive=True,
211
  )
212
  submit_button = gr.Button("πŸ€— Submit Eval πŸ’»")
213
- submission_result = gr.Markdown()
 
 
 
 
 
214
  with gr.Column():
215
  precision = gr.Dropdown(
216
  choices=["fp32","fp16","bf16","int8","fp8", "int4"],
@@ -247,7 +280,7 @@ with demo:
247
  )
248
  base_model_name_textbox = gr.Textbox(label="Base model (for delta or adapter weights)")
249
 
250
- # gr.Markdown("Community Submissions Coming soon!")
251
 
252
  with gr.Accordion("πŸ“™ Citation", open=False):
253
  citation =gr.Textbox(value = CITATION_TEXT,
 
28
  from src.processing import filter_benchmarks_table
29
 
30
  inference_endpoint_url = os.environ['inference_endpoint_url']
31
+ submission_form_endpoint_url = os.environ['submission_form_endpoint_url']
32
  inference_concurrency_limit = os.environ['inference_concurrency_limit']
33
 
34
  demo = gr.Blocks()
 
46
  gr.Markdown("""A special shout-out to the πŸ€— [Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)
47
  team for generously sharing their code and best
48
  practices, ensuring that AI Developers have a valuable and enjoyable tool at their disposal.""")
49
+
50
+ def submit_to_endpoint(model_name, revision_name, model_type, hw_type, terms, precision, weight_type, training_infra, affiliation, base_model):
51
+ # Construct the data payload to send
52
+ data = {
53
+ "model_name": model_name,
54
+ "revision_name": revision_name,
55
+ "model_type": model_type,
56
+ "hw_type": hw_type,
57
+ "terms": terms,
58
+ "precision": precision,
59
+ "weight_type": weight_type,
60
+ "training_infrastructure": training_infra,
61
+ "affiliation": affiliation,
62
+ "base_model": base_model
63
+ }
64
+
65
+ # URL of the endpoint expecting the HTTP request
66
+ url = submission_form_endpoint_url
67
+
68
+ try:
69
+ response = requests.post(url, json=data)
70
+ if response.status_code == 200:
71
+ return "Submission successful!"
72
+ else:
73
+ return f"Submission failed with status code {response.status_code}"
74
+ except Exception as e:
75
+ return f"Failed to submit due to an error: {str(e)}"
76
 
77
  with gr.Accordion("Chat with Top Models on the Leaderboard Here πŸ’¬", open=False):
78
 
 
238
  interactive=True,
239
  )
240
  submit_button = gr.Button("πŸ€— Submit Eval πŸ’»")
241
+ submission_result = gr.Markdown(submission_result)
242
+ submit_button.click(
243
+ fn=submit_to_endpoint,
244
+ inputs=[model_name_textbox, revision_name_textbox, model_type, hw_type, terms, precision, weight_type, training_infra, affiliation, base_model_name_textbox],
245
+ outputs=submission_result
246
+ )
247
  with gr.Column():
248
  precision = gr.Dropdown(
249
  choices=["fp32","fp16","bf16","int8","fp8", "int4"],
 
280
  )
281
  base_model_name_textbox = gr.Textbox(label="Base model (for delta or adapter weights)")
282
 
283
+
284
 
285
  with gr.Accordion("πŸ“™ Citation", open=False):
286
  citation =gr.Textbox(value = CITATION_TEXT,