Spaces:
Runtime error
Runtime error
fix avatar error
Browse files
app.py
CHANGED
@@ -68,8 +68,14 @@ def display_image(url, scale=0.5, enable_flag = False):
|
|
68 |
enable_flag = False if display_img_flag != 'Yes' else True # 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"
|
@@ -209,8 +215,8 @@ with st.sidebar:
|
|
209 |
|
210 |
display_img_flag = st.radio(
|
211 |
"Display Avatar in Description",
|
212 |
-
["
|
213 |
-
captions = ["
|
214 |
)
|
215 |
|
216 |
#########################################
|
|
|
68 |
enable_flag = False if display_img_flag != 'Yes' else True # 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 |
+
"""
|
75 |
+
The problem occur because imgur remove file extension e.g. 'jpg',
|
76 |
+
so either url is wrong with urlopen or Image.open does not know image type if use requests/urllib3
|
77 |
+
"""
|
78 |
+
st.image(url)
|
79 |
|
80 |
def display_heroes_from_df(df,display_cols=display_cols, show_df=True):
|
81 |
vtob = "is" if len(df)<=1 else "are"
|
|
|
215 |
|
216 |
display_img_flag = st.radio(
|
217 |
"Display Avatar in Description",
|
218 |
+
["Yes", "No"],
|
219 |
+
captions = ["Default", "If problem occur, set to 'no'"]
|
220 |
)
|
221 |
|
222 |
#########################################
|