Zack Zhiyuan Li commited on
Commit
0819278
1 Parent(s): 3a81a52

add basic UI

Browse files
Files changed (3) hide show
  1. README.md +2 -1
  2. app.py +107 -0
  3. requirements.txt +1 -0
README.md CHANGED
@@ -10,4 +10,5 @@ pinned: false
10
  license: mit
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
10
  license: mit
11
  ---
12
 
13
+ # specialized-llm-leaderboard
14
+ LLM leaderboard to find the best model for each specific domain
app.py ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import pandas as pd
3
+ from gradio_huggingfacehub_search import HuggingfaceHubSearch
4
+ import requests
5
+
6
+ def update_table(category):
7
+ data_dict = {
8
+ "Overall": {
9
+ "Rank": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26],
10
+ "Model": ["Model A", "Model B", "Model C", "Model D", "Model E", "Model F", "Model G", "Model H", "Model I", "Model J", "Model K", "Model L", "Model M", "Model N", "Model O", "Model P", "Model Q", "Model R", "Model S", "Model T", "Model U", "Model V", "Model W", "Model X", "Model Y", "Model Z"],
11
+ "Votes": [1250, 200, 3150, 4250, 5200, 6150, 7250, 8200, 9150, 10250, 11200, 12150, 13250, 21250, 200, 3150, 4250, 5200, 6150, 7250, 8200, 9150, 10250, 11200, 12150, 13250],
12
+ "Organization": ["Org A", "Org B", "Org C", "Org D", "Org E", "Org F", "Org G", "Org H", "Org I", "Org J", "Org K", "Org L", "Org M", "Org N", "Org O", "Org P", "Org Q", "Model R", "Model S", "Model T", "Model U", "Model V", "Model W", "Model X", "Model Y", "Model Z"],
13
+ "License": ["1MIT", "2Apache 2.0", "3GPL", "4MIT", "5Apache 2.0", "6GPL", "7MIT", "8Apache 2.0", "9GPL", "10MIT", "11Apache 2.0", "12GPL", "13MIT", "1MIT", "2Apache 2.0", "3GPL", "4MIT", "5Apache 2.0", "6GPL", "7MIT", "8Apache 2.0", "9GPL", "10MIT", "11Apache 2.0", "12GPL", "13MIT"]
14
+ },
15
+ "Biology": {
16
+ "Rank": [1, 2],
17
+ "Model": ["GenePredict", "BioSeq"],
18
+ "Votes": [180, 160],
19
+ "Organization": ["BioTech", "Genomics Inc"],
20
+ "License": ["GPL", "MIT"]
21
+ }
22
+ }
23
+
24
+ data = data_dict.get(category, {"Rank": [], "Model": [], "Votes": [], "Organization": [], "License": []})
25
+ df = pd.DataFrame(data)
26
+ return df
27
+
28
+ def submit_vote(category, vote):
29
+ if not category or not vote:
30
+ return "All fields are required!"
31
+ # code
32
+ return f"Vote '{vote}' submitted successfully!"
33
+
34
+ def submit_model(category, model_id):
35
+ if not category or not model_id:
36
+ return "All fields are required!"
37
+
38
+ url = "https://sdk.nexa4ai.com/task" # Will have a new endpoint
39
+
40
+ data = {
41
+ "category": category,
42
+ "model_id": model_id
43
+ }
44
+
45
+ response = requests.post(url, json=data)
46
+
47
+ if response.status_code == 200:
48
+ return "Your request has been submitted successfully. We will notify you by email once processing is complete."
49
+ else:
50
+ return f"Failed to submit request: {response.text}"
51
+
52
+
53
+ with gr.Blocks() as app:
54
+ with gr.Tabs():
55
+ with gr.TabItem("Table"):
56
+ category = gr.Dropdown(
57
+ choices=[
58
+ "Overall", "Biology", "Physics", "Business", "Chemistry",
59
+ "Economics", "Philosophy", "History", "Culture", "Computer Science",
60
+ "Math", "Health", "Law", "Engineering", "Other"
61
+ ],
62
+ label="Select Category",
63
+ value="Overall"
64
+ )
65
+
66
+ initial_data = update_table("Overall")
67
+ table = gr.Dataframe(
68
+ headers=["Rank", "Model", "Votes", "Organization", "License"],
69
+ datatype=["number", "str", "number", "str", "str"],
70
+ value=initial_data,
71
+ col_count=(5, "fixed"),
72
+ )
73
+ category.change(update_table, inputs=category, outputs=table)
74
+
75
+ with gr.TabItem("Vote"):
76
+ category = gr.Dropdown(
77
+ choices=[
78
+ "Biology", "Physics", "Business", "Chemistry",
79
+ "Economics", "Philosophy", "History", "Culture", "Computer Science",
80
+ "Math", "Health", "Law", "Engineering", "Other"
81
+ ],
82
+ label="Select Category"
83
+ )
84
+ vote = gr.CheckboxGroup(choices=["Option 1", "Option 2", "Option 3"], label="Choose your option")
85
+ submit_button = gr.Button("Submit Vote")
86
+ submit_result = gr.Label()
87
+ submit_button.click(fn=submit_vote, inputs=[category, vote], outputs=submit_result)
88
+
89
+ with gr.TabItem("Submit Model"):
90
+ category = gr.Dropdown(
91
+ choices=[
92
+ "Biology", "Physics", "Business", "Chemistry",
93
+ "Economics", "Philosophy", "History", "Culture", "Computer Science",
94
+ "Math", "Health", "Law", "Engineering", "Other"
95
+ ],
96
+ label="Select Category"
97
+ )
98
+ model_id = HuggingfaceHubSearch(
99
+ label="Hub Model ID",
100
+ placeholder="Search for model id on Huggingface",
101
+ search_type="model",
102
+ )
103
+ submit_model_button = gr.Button("Submit Model")
104
+ submit_model_result = gr.Label()
105
+ submit_model_button.click(fn=submit_model, inputs=[category, model_id], outputs=submit_model_result)
106
+
107
+ app.launch()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ gradio_huggingfacehub_search