Grandediw commited on
Commit
58e7b27
·
verified ·
1 Parent(s): 872570f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -2,6 +2,10 @@ import gradio as gr
2
  import pandas as pd
3
  import numpy as np
4
  from xgboost import Booster, DMatrix
 
 
 
 
5
 
6
  # Generating the complete `card_images` dictionary
7
  card_numbers = {
@@ -41,8 +45,9 @@ card_numbers = {
41
  "Wall Breakers/Evolution": 179, "Wizard/Evolution": 180, "Zap/Evolution": 181
42
  }
43
 
 
44
  card_images = {
45
- card_name: f"https://static.wikia.nocookie.net/clashroyale/images/{card_name.replace(' ', '').replace('/', '')}Card.png/revision/latest"
46
  for card_name in card_numbers.keys()
47
  }
48
 
 
2
  import pandas as pd
3
  import numpy as np
4
  from xgboost import Booster, DMatrix
5
+ import requests
6
+ from bs4 import BeautifulSoup
7
+ # Base URL for raw GitHub images
8
+ base_url = "https://raw.githubusercontent.com/RoyaleAPI/cr-api-assets/master/cards/"
9
 
10
  # Generating the complete `card_images` dictionary
11
  card_numbers = {
 
45
  "Wall Breakers/Evolution": 179, "Wizard/Evolution": 180, "Zap/Evolution": 181
46
  }
47
 
48
+ # Normalize card names and generate the full URLs
49
  card_images = {
50
+ card_name: f"{base_url}{card_name.lower().replace(' ', '-').replace('/', '-').replace('.', '')}.png"
51
  for card_name in card_numbers.keys()
52
  }
53