ginipick commited on
Commit
10f1b51
·
verified ·
1 Parent(s): 4855252

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -132,6 +132,8 @@ def create_ui():
132
  .hardware-info {font-size: 12px; color: #666;}
133
  """
134
 
 
 
135
  with gr.Blocks(css=css, theme="Nymbo/Nymbo_Theme") as demo:
136
  gr.Markdown("# Hugging Face Most Liked Spaces")
137
 
@@ -140,7 +142,10 @@ def create_ui():
140
  space_rows = []
141
  for space in formatted_spaces:
142
  with gr.Row(elem_classes="space-row") as space_row:
143
- gr.Image(value=space['thumbnail'], width=100, height=100, show_label=False, elem_classes="thumbnail")
 
 
 
144
  with gr.Column():
145
  gr.Markdown(f"{space['name']} by {space['author']} (Likes: {space['likes']})", elem_classes="space-info")
146
  gr.Markdown(f"Hardware: {space['hardware']}", elem_classes="hardware-info")
 
132
  .hardware-info {font-size: 12px; color: #666;}
133
  """
134
 
135
+ default_thumbnail = "https://huggingface.co/front/assets/huggingface_logo-noborder.svg"
136
+
137
  with gr.Blocks(css=css, theme="Nymbo/Nymbo_Theme") as demo:
138
  gr.Markdown("# Hugging Face Most Liked Spaces")
139
 
 
142
  space_rows = []
143
  for space in formatted_spaces:
144
  with gr.Row(elem_classes="space-row") as space_row:
145
+ try:
146
+ gr.Image(value=space['thumbnail'], width=100, height=100, show_label=False, elem_classes="thumbnail")
147
+ except Exception:
148
+ gr.Image(value=default_thumbnail, width=100, height=100, show_label=False, elem_classes="thumbnail")
149
  with gr.Column():
150
  gr.Markdown(f"{space['name']} by {space['author']} (Likes: {space['likes']})", elem_classes="space-info")
151
  gr.Markdown(f"Hardware: {space['hardware']}", elem_classes="hardware-info")