Spaces:
Runtime error
Runtime error
try to fix imgur error
Browse files
app.py
CHANGED
@@ -61,12 +61,15 @@ def filter_by_1col(df, col_name, query, exact_flag=False):
|
|
61 |
assert len(ok_flag_list) == len(df)
|
62 |
return np.array(ok_flag_list)
|
63 |
|
64 |
-
def display_image(url, scale=0.5):
|
65 |
from urllib.request import urlopen
|
66 |
from PIL import Image
|
67 |
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
70 |
|
71 |
def display_heroes_from_df(df,display_cols=display_cols, show_df=True):
|
72 |
vtob = "is" if len(df)<=1 else "are"
|
@@ -197,6 +200,12 @@ with st.sidebar:
|
|
197 |
[":rainbow[Heroes Explorer]", "Team Simulation","***LB/CB Hero Stat*** :movie_camera:"],
|
198 |
captions = ["Filter only heroes with certain properties", "Co-powered by Elioty33's DataVault"])
|
199 |
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
#########################################
|
201 |
## Program 1
|
202 |
if genre == ':rainbow[Heroes Explorer]':
|
|
|
61 |
assert len(ok_flag_list) == len(df)
|
62 |
return np.array(ok_flag_list)
|
63 |
|
64 |
+
def display_image(url, scale=0.5, enable_flag = False):
|
65 |
from urllib.request import urlopen
|
66 |
from PIL import Image
|
67 |
|
68 |
+
enable_flag = display_img_flag # adhoc code, should send this variable properly
|
69 |
+
|
70 |
+
if enable_flag: # default to False as imgur server seems to refuse our request and cause permanent error
|
71 |
+
image = Image.open(urlopen(url))
|
72 |
+
st.image(image.resize(( int(image.width * scale), int(image.height * scale))))
|
73 |
|
74 |
def display_heroes_from_df(df,display_cols=display_cols, show_df=True):
|
75 |
vtob = "is" if len(df)<=1 else "are"
|
|
|
200 |
[":rainbow[Heroes Explorer]", "Team Simulation","***LB/CB Hero Stat*** :movie_camera:"],
|
201 |
captions = ["Filter only heroes with certain properties", "Co-powered by Elioty33's DataVault"])
|
202 |
|
203 |
+
display_img_flag = st.radio(
|
204 |
+
"Display Avatar in Description",
|
205 |
+
["No", "Yes"],
|
206 |
+
captions = ["Currently default to 'no' since the server seems to ban our service", "If problem occur, set to 'no'"])
|
207 |
+
)
|
208 |
+
|
209 |
#########################################
|
210 |
## Program 1
|
211 |
if genre == ':rainbow[Heroes Explorer]':
|