CultriX commited on
Commit
47a867b
1 Parent(s): 8012c4e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -23,14 +23,15 @@ def cached_model_info(_api, model):
23
  def get_model_info(df):
24
  """Get model information and update the DataFrame with likes and tags."""
25
  api = HfApi()
26
- for index, row in df.iterrows():
27
- model_info = cached_model_info(api, row['Model'].strip())
28
- if model_info:
29
- df.loc[index, 'Likes'] = model_info.likes
30
- df.loc[index, 'Tags'] = ', '.join(model_info.tags)
31
- else:
32
- df.loc[index, 'Likes'] = -1
33
- df.loc[index, 'Tags'] = ''
 
34
  return df
35
 
36
  def convert_markdown_table_to_dataframe(md_content):
@@ -53,7 +54,9 @@ def create_bar_chart(df, category):
53
  y=sorted_df['Model'],
54
  orientation='h',
55
  marker=dict(color=sorted_df[category], colorscale='Viridis'),
56
- hoverinfo='x+y'
 
 
57
  ))
58
  fig.update_layout(
59
  margin=dict(l=20, r=20, t=20, b=20),
 
23
  def get_model_info(df):
24
  """Get model information and update the DataFrame with likes and tags."""
25
  api = HfApi()
26
+ with st.spinner("Fetching model information..."):
27
+ for index, row in df.iterrows():
28
+ model_info = cached_model_info(api, row['Model'].strip())
29
+ if model_info:
30
+ df.loc[index, 'Likes'] = model_info.likes
31
+ df.loc[index, 'Tags'] = ', '.join(model_info.tags)
32
+ else:
33
+ df.loc[index, 'Likes'] = -1
34
+ df.loc[index, 'Tags'] = ''
35
  return df
36
 
37
  def convert_markdown_table_to_dataframe(md_content):
 
54
  y=sorted_df['Model'],
55
  orientation='h',
56
  marker=dict(color=sorted_df[category], colorscale='Viridis'),
57
+ hoverinfo='x+y',
58
+ text=sorted_df[category],
59
+ textposition='auto'
60
  ))
61
  fig.update_layout(
62
  margin=dict(l=20, r=20, t=20, b=20),