Spaces:
Running
Running
import gradio as gr | |
import pandas as pd | |
import plotly.express as px | |
from datetime import datetime, timedelta | |
import requests | |
from io import BytesIO | |
[์ด์ ํจ์๋ค์ ๋์ผํ๊ฒ ์ ์ง...] | |
# Gradio ์ธํฐํ์ด์ค ์์ฑ | |
with gr.Blocks(theme=gr.themes.Soft()) as demo: | |
gr.Markdown(""" | |
# HF Space Ranking Tracker | |
Track, analyze, and discover trending AI applications in the Hugging Face ecosystem. Our service continuously monitors and ranks all Spaces over a 30-day period, providing detailed analytics and daily ranking changes for the top 100 performers. | |
""") | |
with gr.Tabs(): | |
with gr.Tab("Dashboard"): | |
with gr.Row(variant="panel"): | |
trend_plot = gr.Plot( | |
label="Daily Rank Trend", | |
container=True, | |
height=400 | |
) | |
with gr.Row(): | |
info_box = gr.HTML( | |
value="<div style='text-align: center; padding: 20px; color: #666;'>Select a space to view details</div>" | |
) | |
with gr.Row(): | |
space_grid = gr.HTML( | |
value="<div style='display: flex; flex-wrap: wrap; gap: 16px; justify-content: center;'>" + | |
"".join([create_space_card(row) for _, row in top_100_spaces.iterrows()]) + | |
"</div>" | |
) | |
space_selection = gr.Radio( | |
choices=[row['id'] for _, row in top_100_spaces.iterrows()], | |
value=None, | |
visible=False | |
) | |
with gr.Tab("About"): | |
gr.Markdown(""" | |
### Our Tracking System | |
#### What We Track | |
- Daily ranking changes for all Hugging Face Spaces | |
- Comprehensive trending scores based on 30-day activity | |
- Detailed performance metrics for top 100 Spaces | |
- Historical ranking data with daily granularity | |
#### Key Features | |
- **Real-time Rankings**: Stay updated with daily rank changes | |
- **Interactive Visualizations**: Track ranking trajectories over time | |
- **Trend Analysis**: Identify emerging popular AI applications | |
- **Direct Access**: Quick links to explore trending Spaces | |
- **Performance Metrics**: Detailed trending scores and statistics | |
### Why Use HF Space Ranking Tracker? | |
- Discover trending AI demos and applications | |
- Monitor your Space's performance and popularity | |
- Identify emerging trends in the AI community | |
- Make data-driven decisions about your AI projects | |
- Stay ahead of the curve in AI application development | |
Our dashboard provides a comprehensive view of the Hugging Face Spaces ecosystem, helping developers, researchers, and enthusiasts track and understand the dynamics of popular AI applications. Whether you're monitoring your own Space's performance or discovering new trending applications, HF Space Ranking Tracker offers the insights you need. | |
Experience the pulse of the AI community through our daily updated rankings and discover what's making waves in the world of practical AI applications. | |
""") | |
# JavaScript ์ด๋ฒคํธ ์ฒ๋ฆฌ | |
space_grid.click( | |
None, | |
None, | |
None, | |
js="""async (event) => { | |
if (event.target.closest('.space-card')) { | |
const spaceId = event.target.closest('.space-card').dataset.spaceId; | |
document.querySelector(`input[type="radio"][value="${spaceId}"]`).click(); | |
} | |
}""" | |
) | |
space_selection.change( | |
fn=update_display, | |
inputs=[space_selection], | |
outputs=[trend_plot, info_box] | |
) | |
if __name__ == "__main__": | |
demo.launch(share=True) |