nesticot commited on
Commit
6ec23db
·
verified ·
1 Parent(s): 1682abf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -26
app.py CHANGED
@@ -488,32 +488,32 @@ def server(input, output, session):
488
  imagebox = OffsetImage(im, zoom = 0.3)
489
  ab = AnnotationBbox(imagebox, (0.125, 0.8), frameon = False)
490
  ax.add_artist(ab)
491
-
492
- if 'parentOrgId' in player_bio['people'][0]['currentTeam']:
493
- url = team_logos[team_logos['id'] == player_bio['people'][0]['currentTeam']['parentOrgId']]['imageLink'].values[0]
494
-
495
- im = plt.imread(url)
496
- # response = requests.get(url)
497
- # im = Image.open(BytesIO(response.content))
498
- # im = plt.imread(team_logos[team_logos['id'] == player_bio['people'][0]['currentTeam']['parentOrgId']]['imageLink'].values[0])
499
- # ax = fig.add_axes([0,0,1,0.85], anchor='C', zorder=1)
500
- imagebox = OffsetImage(im, zoom = 0.225)
501
- ab = AnnotationBbox(imagebox, (0.875, 0.8), frameon = False)
502
- ax.add_artist(ab)
503
-
504
- else:
505
- url = team_logos[team_logos['id'] == player_bio['people'][0]['currentTeam']['id']]['imageLink'].values[0]
506
- im = plt.imread(team_logos[team_logos['id'] == player_bio['people'][0]['currentTeam']['id']]['imageLink'].values[0])
507
-
508
- # im = plt.imread(url)
509
- # response = requests.get(url)
510
- # im = Image.open(BytesIO(response.content))
511
- #im = plt.imread(team_logos[team_logos['id'] == player_bio['people'][0]['currentTeam']['parentOrgId']]['imageLink'].values[0])
512
-
513
- # ax = fig.add_axes([0,0,1,0.85], anchor='C', zorder=1)
514
- imagebox = OffsetImage(im, zoom = 0.225)
515
- ab = AnnotationBbox(imagebox, (0.875, 0.8), frameon = False)
516
- ax.add_artist(ab)
517
 
518
  ax.text(s = f'2024 {dict_level[sport_id_input]} Metrics',
519
 
 
488
  imagebox = OffsetImage(im, zoom = 0.3)
489
  ab = AnnotationBbox(imagebox, (0.125, 0.8), frameon = False)
490
  ax.add_artist(ab)
491
+ try:
492
+ if 'parentOrgId' in player_bio['people'][0]['currentTeam']:
493
+ url = team_logos[team_logos['id'] == player_bio['people'][0]['currentTeam']['parentOrgId']]['imageLink'].values[0]
494
+
495
+ im = plt.imread(url)
496
+ # response = requests.get(url)
497
+ # im = Image.open(BytesIO(response.content))
498
+ # im = plt.imread(team_logos[team_logos['id'] == player_bio['people'][0]['currentTeam']['parentOrgId']]['imageLink'].values[0])
499
+ # ax = fig.add_axes([0,0,1,0.85], anchor='C', zorder=1)
500
+ imagebox = OffsetImage(im, zoom = 0.225)
501
+ ab = AnnotationBbox(imagebox, (0.875, 0.8), frameon = False)
502
+ ax.add_artist(ab)
503
+ except KeyError:
504
+ print('')
505
+ # url = team_logos[team_logos['id'] == player_bio['people'][0]['currentTeam']['id']]['imageLink'].values[0]
506
+ # im = plt.imread(team_logos[team_logos['id'] == player_bio['people'][0]['currentTeam']['id']]['imageLink'].values[0])
507
+
508
+ # # im = plt.imread(url)
509
+ # # response = requests.get(url)
510
+ # # im = Image.open(BytesIO(response.content))
511
+ # #im = plt.imread(team_logos[team_logos['id'] == player_bio['people'][0]['currentTeam']['parentOrgId']]['imageLink'].values[0])
512
+
513
+ # # ax = fig.add_axes([0,0,1,0.85], anchor='C', zorder=1)
514
+ # imagebox = OffsetImage(im, zoom = 0.225)
515
+ # ab = AnnotationBbox(imagebox, (0.875, 0.8), frameon = False)
516
+ # ax.add_artist(ab)
517
 
518
  ax.text(s = f'2024 {dict_level[sport_id_input]} Metrics',
519