ashikshaffi08 commited on
Commit
3eaa599
1 Parent(s): c67cfc6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -21,6 +21,7 @@ LANGUAGES_SUPPORTED = """
21
  <h3 align="center">Languages Supported</h3>
22
  <p align="center">Arabic, Chinese, English, French, German, Hebrew, Hindi, Portuguese, Russian, Spanish, Urdu, Vietnamese, and more to come!</p>
23
  """
 
24
  netuid = 1
25
  node_url = "wss://commune-api-node-2.communeai.net"
26
 
@@ -61,12 +62,12 @@ async def make_query(client: CommuneClient) -> tuple[dict[int, int], dict[int, s
61
  names = result["Name"]
62
  highest_uid = max(names.keys())
63
  for uid in range(highest_uid + 1):
64
- emission = netuid_emission[uid]
65
  if emission != 0:
66
- incentive = netuid_incentive[uid]
67
- dividends = netuid_dividends[uid]
68
  if incentive > 0:
69
- emission_dict[uid] = netuid_emission[uid]
70
  name_dict[uid] = names[uid]
71
  return emission_dict, name_dict
72
 
@@ -202,10 +203,10 @@ with gr.Blocks(theme=seafoam, analytics_enabled=True, css=custom_css) as demo:
202
  elem_id="leaderboard-table",
203
  )
204
  refresh_button = gr.Button("Refresh Leaderboard")
205
- refresh_button.click(fn=update_leaderboard_table, outputs=[
206
  leaderboard_table, total_usd_value_html])
207
 
208
- demo.load(update_leaderboard_table, inputs=None, outputs=[
209
  leaderboard_table, total_usd_value_html])
210
 
211
  if __name__ == "__main__":
 
21
  <h3 align="center">Languages Supported</h3>
22
  <p align="center">Arabic, Chinese, English, French, German, Hebrew, Hindi, Portuguese, Russian, Spanish, Urdu, Vietnamese, and more to come!</p>
23
  """
24
+
25
  netuid = 1
26
  node_url = "wss://commune-api-node-2.communeai.net"
27
 
 
62
  names = result["Name"]
63
  highest_uid = max(names.keys())
64
  for uid in range(highest_uid + 1):
65
+ emission = netuid_emission.get(uid, 0)
66
  if emission != 0:
67
+ incentive = netuid_incentive.get(uid, 0)
68
+ dividends = netuid_dividends.get(uid, 0)
69
  if incentive > 0:
70
+ emission_dict[uid] = emission
71
  name_dict[uid] = names[uid]
72
  return emission_dict, name_dict
73
 
 
203
  elem_id="leaderboard-table",
204
  )
205
  refresh_button = gr.Button("Refresh Leaderboard")
206
+ refresh_button.click(fn=lambda: asyncio.run(update_leaderboard_table()), outputs=[
207
  leaderboard_table, total_usd_value_html])
208
 
209
+ demo.load(lambda: asyncio.run(update_leaderboard_table()), inputs=None, outputs=[
210
  leaderboard_table, total_usd_value_html])
211
 
212
  if __name__ == "__main__":