Commit
·
ec62d23
1
Parent(s):
e12fa94
Upload folder using huggingface_hub
Browse files- requirements.txt +1 -1
- run.ipynb +1 -1
- run.py +1 -1
requirements.txt
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
https://gradio-builds.s3.amazonaws.com/
|
2 |
plotly
|
3 |
pypistats
|
|
|
1 |
+
https://gradio-builds.s3.amazonaws.com/da05e59a53bbad15e5755a47f46685da18e1031e/gradio-3.44.4-py3-none-any.whl
|
2 |
plotly
|
3 |
pypistats
|
run.ipynb
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"cells": [{"cell_type": "markdown", "id": 302934307671667531413257853548643485645, "metadata": {}, "source": ["# Gradio Demo: blocks_multiple_event_triggers"]}, {"cell_type": "code", "execution_count": null, "id": 272996653310673477252411125948039410165, "metadata": {}, "outputs": [], "source": ["!pip install -q gradio plotly pypistats"]}, {"cell_type": "code", "execution_count": null, "id": 288918539441861185822528903084949547379, "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "import pypistats\n", "from datetime import date\n", "from dateutil.relativedelta import relativedelta\n", "import pandas as pd\n", "\n", "def get_plot(lib, time):\n", " data = pypistats.overall(lib, total=True, format=\"pandas\")\n", " data = data.groupby(\"category\").get_group(\"with_mirrors\").sort_values(\"date\")\n", " start_date = date.today() - relativedelta(months=int(time.split(\" \")[0]))\n", " data = data[(data['date'] > str(start_date))]\n", " data.date = pd.to_datetime(pd.to_datetime(data.date))\n", " return gr.LinePlot
|
|
|
1 |
+
{"cells": [{"cell_type": "markdown", "id": 302934307671667531413257853548643485645, "metadata": {}, "source": ["# Gradio Demo: blocks_multiple_event_triggers"]}, {"cell_type": "code", "execution_count": null, "id": 272996653310673477252411125948039410165, "metadata": {}, "outputs": [], "source": ["!pip install -q gradio plotly pypistats"]}, {"cell_type": "code", "execution_count": null, "id": 288918539441861185822528903084949547379, "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "import pypistats\n", "from datetime import date\n", "from dateutil.relativedelta import relativedelta\n", "import pandas as pd\n", "\n", "def get_plot(lib, time):\n", " data = pypistats.overall(lib, total=True, format=\"pandas\")\n", " data = data.groupby(\"category\").get_group(\"with_mirrors\").sort_values(\"date\")\n", " start_date = date.today() - relativedelta(months=int(time.split(\" \")[0]))\n", " data = data[(data['date'] > str(start_date))]\n", " data.date = pd.to_datetime(pd.to_datetime(data.date))\n", " return gr.LinePlot(value=data, x=\"date\", y=\"downloads\",\n", " tooltip=['date', 'downloads'],\n", " title=f\"Pypi downloads of {lib} over last {time}\",\n", " overlay_point=True,\n", " height=400,\n", " width=900)\n", "\n", "\n", "with gr.Blocks() as demo:\n", " gr.Markdown(\n", " \"\"\"\n", " ## Pypi Download Stats \ud83d\udcc8\n", " See live download stats for all of Hugging Face's open-source libraries \ud83e\udd17\n", " \"\"\")\n", " with gr.Row():\n", " lib = gr.Dropdown([\"transformers\", \"datasets\", \"huggingface-hub\", \"gradio\", \"accelerate\"],\n", " value=\"gradio\", label=\"Library\")\n", " time = gr.Dropdown([\"3 months\", \"6 months\", \"9 months\", \"12 months\"],\n", " value=\"3 months\", label=\"Downloads over the last...\")\n", "\n", " plt = gr.LinePlot()\n", " # You can add multiple event triggers in 2 lines like this\n", " for event in [lib.change, time.change, demo.load]:\n", " event(get_plot, [lib, time], [plt])\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
run.py
CHANGED
@@ -10,7 +10,7 @@ def get_plot(lib, time):
|
|
10 |
start_date = date.today() - relativedelta(months=int(time.split(" ")[0]))
|
11 |
data = data[(data['date'] > str(start_date))]
|
12 |
data.date = pd.to_datetime(pd.to_datetime(data.date))
|
13 |
-
return gr.LinePlot
|
14 |
tooltip=['date', 'downloads'],
|
15 |
title=f"Pypi downloads of {lib} over last {time}",
|
16 |
overlay_point=True,
|
|
|
10 |
start_date = date.today() - relativedelta(months=int(time.split(" ")[0]))
|
11 |
data = data[(data['date'] > str(start_date))]
|
12 |
data.date = pd.to_datetime(pd.to_datetime(data.date))
|
13 |
+
return gr.LinePlot(value=data, x="date", y="downloads",
|
14 |
tooltip=['date', 'downloads'],
|
15 |
title=f"Pypi downloads of {lib} over last {time}",
|
16 |
overlay_point=True,
|