bhaskartripathi commited on
Commit
6f3f56d
1 Parent(s): 16eefe3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -30
app.py CHANGED
@@ -44,39 +44,10 @@ def scrape_leaderboard(leaderboard):
44
  def update_leaderboard(leaderboard):
45
  try:
46
  df = scrape_leaderboard(leaderboard)
47
- return df, create_interactive_table(df)
48
  except Exception as e:
49
  return None, f"An error occurred: {str(e)}"
50
 
51
- def create_interactive_table(df):
52
- html = f"""
53
- <script src="https://cdn.jsdelivr.net/npm/ag-grid-community/dist/ag-grid-community.min.js"></script>
54
- <div id="myGrid" style="height: 500px; width: 100%;" class="ag-theme-alpine"></div>
55
- <script>
56
- var gridOptions = {{
57
- columnDefs: [
58
- {{field: "Rank", sortable: true, filter: true}},
59
- {{field: "Model", sortable: true, filter: true}},
60
- {{field: "Score", sortable: true, filter: true}},
61
- {{field: "95% Confidence", sortable: true, filter: true}}
62
- ],
63
- rowData: {df.to_dict(orient='records')},
64
- defaultColDef: {{
65
- flex: 1,
66
- minWidth: 100,
67
- resizable: true,
68
- }},
69
- domLayout: 'autoHeight'
70
- }};
71
-
72
- document.addEventListener('DOMContentLoaded', function() {{
73
- var gridDiv = document.querySelector('#myGrid');
74
- new agGrid.Grid(gridDiv, gridOptions);
75
- }});
76
- </script>
77
- """
78
- return html
79
-
80
  def export_to_excel(df):
81
  if df is not None:
82
  output = io.BytesIO()
 
44
  def update_leaderboard(leaderboard):
45
  try:
46
  df = scrape_leaderboard(leaderboard)
47
+ return df, df.to_html(index=False)
48
  except Exception as e:
49
  return None, f"An error occurred: {str(e)}"
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  def export_to_excel(df):
52
  if df is not None:
53
  output = io.BytesIO()