Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -126,20 +126,28 @@ def search_spaces(search_text, category):
|
|
126 |
|
127 |
# Format the results as HTML with clickable links and stats
|
128 |
html_content = f"""
|
129 |
-
<div style='margin-bottom: 20px; padding: 10px; background-color:
|
130 |
-
<h3>Statistics:</h3>
|
131 |
-
<p>Total Spaces: {total_spaces}</p>
|
132 |
-
<p>Total Likes: {total_likes:,}</p>
|
133 |
</div>
|
134 |
<div style='max-height: 500px; overflow-y: auto;'>
|
135 |
"""
|
136 |
|
137 |
for _, row in spaces.iterrows():
|
138 |
html_content += f"""
|
139 |
-
<div style='margin: 10px; padding: 15px; border: 1px solid
|
140 |
-
|
141 |
-
<
|
142 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
</div>
|
144 |
"""
|
145 |
html_content += "</div>"
|
@@ -147,7 +155,13 @@ def search_spaces(search_text, category):
|
|
147 |
|
148 |
# Create the Gradio interface
|
149 |
def create_app():
|
150 |
-
with gr.Blocks(
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
gr.Markdown("""
|
152 |
# 🤗 Hugging Face Spaces Explorer
|
153 |
Explore and discover popular Hugging Face Spaces by category
|
|
|
126 |
|
127 |
# Format the results as HTML with clickable links and stats
|
128 |
html_content = f"""
|
129 |
+
<div style='margin-bottom: 20px; padding: 10px; background-color: var(--color-background-primary); border: 1px solid var(--color-border-primary); border-radius: 5px;'>
|
130 |
+
<h3 style='color: var(--color-text-primary);'>Statistics:</h3>
|
131 |
+
<p style='color: var(--color-text-primary);'>Total Spaces: {total_spaces}</p>
|
132 |
+
<p style='color: var(--color-text-primary);'>Total Likes: {total_likes:,}</p>
|
133 |
</div>
|
134 |
<div style='max-height: 500px; overflow-y: auto;'>
|
135 |
"""
|
136 |
|
137 |
for _, row in spaces.iterrows():
|
138 |
html_content += f"""
|
139 |
+
<div style='margin: 10px; padding: 15px; border: 1px solid var(--color-border-primary);
|
140 |
+
border-radius: 5px; background-color: var(--color-background-primary);'>
|
141 |
+
<h3><a href='{row['url']}' target='_blank'
|
142 |
+
style='color: #2196F3; text-decoration: none;
|
143 |
+
font-weight: bold;'>{row['title']}</a></h3>
|
144 |
+
<p style='color: var(--color-text-primary); margin: 8px 0;'>
|
145 |
+
<span style='background-color: var(--color-accent-soft);
|
146 |
+
padding: 2px 8px; border-radius: 12px;'>
|
147 |
+
{row['category']}
|
148 |
+
</span>
|
149 |
+
</p>
|
150 |
+
<p style='color: var(--color-text-primary);'>❤️ {row['likes']:,} likes</p>
|
151 |
</div>
|
152 |
"""
|
153 |
html_content += "</div>"
|
|
|
155 |
|
156 |
# Create the Gradio interface
|
157 |
def create_app():
|
158 |
+
with gr.Blocks(
|
159 |
+
title="Hugging Face Spaces Explorer",
|
160 |
+
theme=gr.themes.Soft(
|
161 |
+
primary_hue="blue",
|
162 |
+
secondary_hue="blue",
|
163 |
+
)
|
164 |
+
) as app:
|
165 |
gr.Markdown("""
|
166 |
# 🤗 Hugging Face Spaces Explorer
|
167 |
Explore and discover popular Hugging Face Spaces by category
|