samuelrince commited on
Commit
7825e11
ยท
1 Parent(s): a7e707d

refactor: change location selection for expert mode

Browse files
Files changed (2) hide show
  1. src/electricity_mix.py +2 -2
  2. src/expert.py +16 -12
src/electricity_mix.py CHANGED
@@ -5,6 +5,7 @@ import pandas as pd
5
 
6
  PATH = "src/data/electricity_mix.csv"
7
  COUNTRY_CODES = [
 
8
  ("๐Ÿ‡ฆ๐Ÿ‡บ Australia", "AUS"),
9
  ("๐Ÿ‡ฆ๐Ÿ‡น Austria", "AUT"),
10
  ("๐Ÿ‡ฆ๐Ÿ‡ท Argentina", "ARG"),
@@ -53,8 +54,7 @@ COUNTRY_CODES = [
53
  ("๐Ÿ‡น๐Ÿ‡ญ Thailand", "THA"),
54
  ("๐Ÿ‡น๐Ÿ‡ท Turkey", "TUR"),
55
  ("๐Ÿ‡น๐Ÿ‡ผ Taiwan", "TWN"),
56
- ("๐Ÿ‡บ๐Ÿ‡ธ United States", "USA"),
57
- ("๐ŸŒŽ World", "WOR"),
58
  ]
59
 
60
  CRITERIA = {
 
5
 
6
  PATH = "src/data/electricity_mix.csv"
7
  COUNTRY_CODES = [
8
+ ("๐ŸŒŽ World", "WOR"),
9
  ("๐Ÿ‡ฆ๐Ÿ‡บ Australia", "AUS"),
10
  ("๐Ÿ‡ฆ๐Ÿ‡น Austria", "AUT"),
11
  ("๐Ÿ‡ฆ๐Ÿ‡ท Argentina", "ARG"),
 
54
  ("๐Ÿ‡น๐Ÿ‡ญ Thailand", "THA"),
55
  ("๐Ÿ‡น๐Ÿ‡ท Turkey", "TUR"),
56
  ("๐Ÿ‡น๐Ÿ‡ผ Taiwan", "TWN"),
57
+ ("๐Ÿ‡บ๐Ÿ‡ธ United States", "USA")
 
58
  ]
59
 
60
  CRITERIA = {
src/expert.py CHANGED
@@ -20,11 +20,11 @@ def expert_mode():
20
 
21
  ########## Model info ##########
22
 
23
- col1, col2, col3 = st.columns(3)
24
 
25
  df = load_models(filter_main=True)
26
 
27
- with col1:
28
  provider_exp = st.selectbox(
29
  label="Provider",
30
  options=[x for x in df["provider_clean"].unique()],
@@ -32,7 +32,7 @@ def expert_mode():
32
  key=1,
33
  )
34
 
35
- with col2:
36
  model_exp = st.selectbox(
37
  label="Model",
38
  options=[
@@ -72,14 +72,14 @@ def expert_mode():
72
 
73
  ########## Model parameters ##########
74
 
75
- col11, col22, col33 = st.columns(3)
76
 
77
- with col11:
78
  active_params = st.number_input(
79
  "Active parameters (B)", 0, None, active_params
80
  )
81
 
82
- with col22:
83
  total_params = st.number_input(
84
  "Total parameters (B)", 0, None, total_params
85
  )
@@ -88,14 +88,14 @@ def expert_mode():
88
  with st.container(border=True):
89
  st.markdown("###### Configure the prompt")
90
 
91
- col1, col2 = st.columns(2)
92
 
93
- with col1:
94
  output_tokens_exp = st.selectbox(
95
  label="Example prompt", options=[x[0] for x in PROMPTS], key=3
96
  )
97
 
98
- with col2:
99
  output_tokens = st.number_input(
100
  label="Output completion tokens",
101
  min_value=0,
@@ -106,12 +106,16 @@ def expert_mode():
106
  with st.container(border=True):
107
  st.markdown("###### Configure the electricity mix of the data center")
108
 
109
- location = st.selectbox("Location", [x[0] for x in COUNTRY_CODES])
 
 
 
 
 
110
 
111
  col4, col5, col6, col7 = st.columns(4)
112
 
113
- country_code = [x[1] for x in COUNTRY_CODES if x[0] == location][0]
114
- electricity_mix = electricity_mixes.find_electricity_mix(country_code)
115
 
116
  with col4:
117
  em_gwp = st.number_input(
 
20
 
21
  ########## Model info ##########
22
 
23
+ provider_col, model_col = st.columns(2)
24
 
25
  df = load_models(filter_main=True)
26
 
27
+ with provider_col:
28
  provider_exp = st.selectbox(
29
  label="Provider",
30
  options=[x for x in df["provider_clean"].unique()],
 
32
  key=1,
33
  )
34
 
35
+ with model_col:
36
  model_exp = st.selectbox(
37
  label="Model",
38
  options=[
 
72
 
73
  ########## Model parameters ##########
74
 
75
+ active_params_col, total_params_col = st.columns(2)
76
 
77
+ with active_params_col:
78
  active_params = st.number_input(
79
  "Active parameters (B)", 0, None, active_params
80
  )
81
 
82
+ with total_params_col:
83
  total_params = st.number_input(
84
  "Total parameters (B)", 0, None, total_params
85
  )
 
88
  with st.container(border=True):
89
  st.markdown("###### Configure the prompt")
90
 
91
+ provider_col, model_col = st.columns(2)
92
 
93
+ with provider_col:
94
  output_tokens_exp = st.selectbox(
95
  label="Example prompt", options=[x[0] for x in PROMPTS], key=3
96
  )
97
 
98
+ with model_col:
99
  output_tokens = st.number_input(
100
  label="Output completion tokens",
101
  min_value=0,
 
106
  with st.container(border=True):
107
  st.markdown("###### Configure the electricity mix of the data center")
108
 
109
+ location = st.selectbox(
110
+ label="Data center location",
111
+ options=[c[1] for c in COUNTRY_CODES],
112
+ format_func=format_country_name,
113
+ index=0
114
+ )
115
 
116
  col4, col5, col6, col7 = st.columns(4)
117
 
118
+ electricity_mix = electricity_mixes.find_electricity_mix(location)
 
119
 
120
  with col4:
121
  em_gwp = st.number_input(