Spaces:
Runtime error
Runtime error
minor fix team simulation avatar
Browse files
app.py
CHANGED
@@ -78,8 +78,11 @@ def display_heroes_from_df(df,display_cols=display_cols, show_df=True):
|
|
78 |
if show_df:
|
79 |
st.dataframe(df[display_cols],
|
80 |
column_config={
|
81 |
-
"image": st.column_config.ImageColumn("Avatar", help=""
|
|
|
|
|
82 |
use_container_width=True,
|
|
|
83 |
hide_index=True)
|
84 |
|
85 |
for i in range(len(df)):
|
@@ -313,8 +316,8 @@ if genre == ':rainbow[Heroes Explorer]':
|
|
313 |
## Program 2 "Team Simulation"
|
314 |
elif genre == "Team Simulation":
|
315 |
|
316 |
-
def choose_hero(key="Hero1"):
|
317 |
-
name_choice = st.selectbox(label='Hero Name:', options=all_name_extra, index=
|
318 |
costume_list = return_costume_list(df_extra, name_choice)
|
319 |
costume_choice = st.selectbox(label='Costume:', options=costume_list, index=0, key=key+"_costume")
|
320 |
lb_list = ['None', 'LB1', 'LB2']
|
@@ -348,7 +351,7 @@ elif genre == "Team Simulation":
|
|
348 |
total_power = 0
|
349 |
for ii in range(nheroes_choice):
|
350 |
with col_list[ii]:
|
351 |
-
df_hero_list.append(choose_hero(key=f"Hero{ii+1}")) # 'key' in st.selectbox to differentiate widgets
|
352 |
write_short_description(df_hero_list[-1])
|
353 |
total_power += df_hero_list[ii]['power'].values[0]
|
354 |
|
@@ -362,7 +365,7 @@ elif genre == "Team Simulation":
|
|
362 |
st.write(f'### Total power = {total_power}')
|
363 |
st.write(f'======================')
|
364 |
|
365 |
-
display_heroes_from_df(df_hero_all5, display_cols=df_hero_all5.columns[:-2], show_df=
|
366 |
|
367 |
#########################################
|
368 |
## Program 3 "Individual Stat"
|
|
|
78 |
if show_df:
|
79 |
st.dataframe(df[display_cols],
|
80 |
column_config={
|
81 |
+
"image": st.column_config.ImageColumn("Avatar", help="",
|
82 |
+
# width="medium", # width alone doesnt matter and there is no height option
|
83 |
+
)},
|
84 |
use_container_width=True,
|
85 |
+
# height=128, # this is height of the whold df, not on each line
|
86 |
hide_index=True)
|
87 |
|
88 |
for i in range(len(df)):
|
|
|
316 |
## Program 2 "Team Simulation"
|
317 |
elif genre == "Team Simulation":
|
318 |
|
319 |
+
def choose_hero(key="Hero1", default_index=0):
|
320 |
+
name_choice = st.selectbox(label='Hero Name:', options=all_name_extra, index=default_index, key=key+"_name")
|
321 |
costume_list = return_costume_list(df_extra, name_choice)
|
322 |
costume_choice = st.selectbox(label='Costume:', options=costume_list, index=0, key=key+"_costume")
|
323 |
lb_list = ['None', 'LB1', 'LB2']
|
|
|
351 |
total_power = 0
|
352 |
for ii in range(nheroes_choice):
|
353 |
with col_list[ii]:
|
354 |
+
df_hero_list.append(choose_hero(key=f"Hero{ii+1}", default_index=ii)) # 'key' in st.selectbox to differentiate widgets
|
355 |
write_short_description(df_hero_list[-1])
|
356 |
total_power += df_hero_list[ii]['power'].values[0]
|
357 |
|
|
|
365 |
st.write(f'### Total power = {total_power}')
|
366 |
st.write(f'======================')
|
367 |
|
368 |
+
display_heroes_from_df(df_hero_all5, display_cols=df_hero_all5.columns[:-2], show_df=True) # display all except special-skill text
|
369 |
|
370 |
#########################################
|
371 |
## Program 3 "Individual Stat"
|