{ "cells": [ { "cell_type": "code", "execution_count": 14, "id": "ae4232b9-fb9f-419a-9992-8481d1de6b61", "metadata": {}, "outputs": [], "source": [ "#|export\n", "import gradio as gr\n", "import pandas as pd\n", "from huggingface_hub import list_models" ] }, { "cell_type": "code", "execution_count": 71, "id": "82d94a98-0e69-4400-9cb1-2e90ef6da519", "metadata": {}, "outputs": [], "source": [ "#|export\n", "def get_submissions(category):\n", " submissions = list_models(filter=[\"dreambooth-hackathon\", category], full=True)\n", " leaderboard_models = []\n", "\n", " for submission in submissions:\n", " # user, model, likes\n", " leaderboard_models.append(\n", " (\n", " submission.id.split(\"/\")[0],\n", " submission.id.split(\"/\")[-1],\n", " submission.likes,\n", " )\n", " )\n", "\n", " df = pd.DataFrame(data=leaderboard_models, columns=[\"User\", \"Model\", \"Likes\"])\n", " df.sort_values(by=[\"Likes\"], ascending=False, inplace=True)\n", " df.insert(0, \"Rank\", list(range(1, len(df) + 1)))\n", " return df" ] }, { "cell_type": "code", "execution_count": 74, "id": "7579bfc6-ddf6-444d-ab7e-505734d86e4d", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/Users/lewtun/miniconda3/envs/hf/lib/python3.8/site-packages/gradio/outputs.py:127: UserWarning: Usage of gradio.outputs is deprecated, and will not be supported in the future, please import your components from gradio.components\n", " warnings.warn(\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Running on local URL: http://127.0.0.1:7876\n", "\n", "To create a public link, set `share=True` in `launch()`.\n" ] }, { "data": { "text/html": [ "
" ], "text/plain": [ "