Koshti10 commited on
Commit
f4bce5b
·
verified ·
1 Parent(s): 092c9c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -115
app.py CHANGED
@@ -1,83 +1,11 @@
1
  import pandas as pd
2
  import gradio as gr
3
  import os
4
- from gradio_rangeslider import RangeSlider
5
 
6
- from src.filter_utils import filter, filter_cols
7
-
8
- # Main Leaderboard containing everything
9
- text_leaderboard = pd.read_csv(os.path.join('assets', 'merged_data.csv'))
10
- text_leaderboard = text_leaderboard.sort_values(by='Clemscore', ascending=False)
11
-
12
- open_weight_df = text_leaderboard[text_leaderboard['Open Weight'] == True]
13
- if not open_weight_df.empty: # Check if filtered df is non-empty
14
- max_parameter_size = open_weight_df['Parameters (B)'].max()
15
-
16
- # Short leaderboard containing fixed columns
17
- short_leaderboard = filter_cols(text_leaderboard)
18
-
19
- ## Extract data
20
- langs = []
21
- licenses = []
22
- ip_prices = []
23
- op_prices = []
24
- latencies = []
25
- parameters = []
26
- contexts = []
27
- dates = []
28
-
29
- for i in range(len(text_leaderboard)):
30
- lang_splits = text_leaderboard.iloc[i]['Languages'].split(',')
31
- lang_splits = [s.strip() for s in lang_splits]
32
- langs += lang_splits
33
- license_name = text_leaderboard.iloc[i]['License Name']
34
-
35
- licenses.append(license_name)
36
- ip_prices.append(text_leaderboard.iloc[i]['Input $/1M tokens'])
37
- op_prices.append(text_leaderboard.iloc[i]['Output $/1M tokens'])
38
- latencies.append(text_leaderboard.iloc[i]['Latency (s)'])
39
- parameters.append(text_leaderboard.iloc[i]['Parameters (B)'])
40
- contexts.append(text_leaderboard.iloc[i]['Context Size (k)'])
41
- dates.append(text_leaderboard.iloc[i]['Release Date'])
42
-
43
-
44
- langs = list(set(langs))
45
- langs.sort()
46
-
47
- licenses = list(set(licenses))
48
- licenses.sort()
49
-
50
- max_input_price = max(ip_prices)
51
- max_output_price = max(op_prices)
52
- max_latency = max(latencies)
53
-
54
- min_parameters = 0 if pd.isna(min(parameters)) else min(parameters)
55
- max_parameter = max_parameter_size
56
- parameter_step = 1
57
- print(f"MIN {min_parameters}, MAX {max_parameter}")
58
-
59
- min_context = min(contexts)
60
- max_context = max(contexts)
61
- context_step = 8
62
-
63
- min_date = min(dates)
64
- max_date = max(dates)
65
-
66
- TITLE = """<h1 align="center" id="space-title"> LLM Calculator ⚖️⚡ 📏💰</h1>"""
67
- CSS = """
68
- #double-slider-1 {height: 100px}
69
- #double-slider-2 {height: 100px}
70
- #double-slider-3 {height: 100px}
71
- #double-slider-4 {height: 100px}
72
- """
73
-
74
- llm_calc_app = gr.Blocks(css=CSS)
75
  with llm_calc_app:
76
 
77
- gr.HTML(TITLE)
78
-
79
  ##################################################
80
-
81
  with gr.Row():
82
 
83
  #####################################
@@ -86,14 +14,6 @@ with llm_calc_app:
86
  ## Language Select
87
  with gr.Column():
88
 
89
- with gr.Row():
90
- lang_dropdown = gr.Dropdown(
91
- choices=langs,
92
- value=[],
93
- multiselect=True,
94
- label="Select Languages 🗣️"
95
- )
96
-
97
  with gr.Row():
98
  start_date = gr.DateTime(
99
  )
@@ -106,37 +26,3 @@ with llm_calc_app:
106
  llm_calc_app.queue()
107
  llm_calc_app.launch()
108
 
109
-
110
-
111
- """
112
- model_name, input_price, output_price,
113
- multimodality_image,multimodality_multiple_image,multimodality_audio,multimodality_video,
114
- source,licence_name,licence_url,languages,release_date,
115
- parameters_estimated,parameters_actual,
116
-
117
- open_weight,context,
118
-
119
- additional_prices_context_caching,
120
- additional_prices_context_storage,
121
- additional_prices_image_input,additional_prices_image_output,additional_prices_video_input,additional_prices_video_output,additional_prices_audio_input,additional_prices_audio_output,clemscore_v1.6.5_multimodal,clemscore_v1.6.5_ascii,clemscore_v1.6,latency_v1.6,latency_v1.6.5_multimodal,latency_v1.6.5_ascii,
122
-
123
- average_clemscore,average_latency,parameters
124
-
125
- Final list
126
-
127
- model_name, input_price, output_price,
128
- multimodality_image,multimodality_multiple_image,multimodality_audio,multimodality_video,
129
- source,licence_name,licence_url,languages,release_date, open_weight,context, average_clemscore,average_latency,parameters
130
-
131
-
132
- Filter
133
- multimodality_image,multimodality_multiple_image,multimodality_audio,multimodality_video,
134
- licence_name+licence_url, languages, release_date, open_weight
135
-
136
- RR
137
- model_name, input_price, output_price,
138
- source, release_date
139
-
140
- """
141
-
142
-
 
1
  import pandas as pd
2
  import gradio as gr
3
  import os
 
4
 
5
+ llm_calc_app = gr.Blocks()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  with llm_calc_app:
7
 
 
 
8
  ##################################################
 
9
  with gr.Row():
10
 
11
  #####################################
 
14
  ## Language Select
15
  with gr.Column():
16
 
 
 
 
 
 
 
 
 
17
  with gr.Row():
18
  start_date = gr.DateTime(
19
  )
 
26
  llm_calc_app.queue()
27
  llm_calc_app.launch()
28