Spaces:
Sleeping
Sleeping
Upload app_gradio.ipynb
Browse files- app_gradio.ipynb +307 -0
app_gradio.ipynb
ADDED
@@ -0,0 +1,307 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"nbformat": 4,
|
3 |
+
"nbformat_minor": 0,
|
4 |
+
"metadata": {
|
5 |
+
"colab": {
|
6 |
+
"provenance": []
|
7 |
+
},
|
8 |
+
"kernelspec": {
|
9 |
+
"name": "python3",
|
10 |
+
"display_name": "Python 3"
|
11 |
+
},
|
12 |
+
"language_info": {
|
13 |
+
"name": "python"
|
14 |
+
}
|
15 |
+
},
|
16 |
+
"cells": [
|
17 |
+
{
|
18 |
+
"cell_type": "code",
|
19 |
+
"execution_count": 2,
|
20 |
+
"metadata": {
|
21 |
+
"id": "2rTwCSHh4PQD",
|
22 |
+
"colab": {
|
23 |
+
"base_uri": "https://localhost:8080/",
|
24 |
+
"height": 1000
|
25 |
+
},
|
26 |
+
"outputId": "b3902c30-a3f0-4903-9269-aa3591998f14"
|
27 |
+
},
|
28 |
+
"outputs": [
|
29 |
+
{
|
30 |
+
"output_type": "stream",
|
31 |
+
"name": "stdout",
|
32 |
+
"text": [
|
33 |
+
"Collecting dash\n",
|
34 |
+
" Downloading dash-2.13.0-py3-none-any.whl (10.4 MB)\n",
|
35 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m10.4/10.4 MB\u001b[0m \u001b[31m79.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
36 |
+
"\u001b[?25hRequirement already satisfied: Flask<2.3.0,>=1.0.4 in /usr/local/lib/python3.10/dist-packages (from dash) (2.2.5)\n",
|
37 |
+
"Collecting Werkzeug<2.3.0 (from dash)\n",
|
38 |
+
" Downloading Werkzeug-2.2.3-py3-none-any.whl (233 kB)\n",
|
39 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m233.6/233.6 kB\u001b[0m \u001b[31m26.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
40 |
+
"\u001b[?25hRequirement already satisfied: plotly>=5.0.0 in /usr/local/lib/python3.10/dist-packages (from dash) (5.15.0)\n",
|
41 |
+
"Collecting dash-html-components==2.0.0 (from dash)\n",
|
42 |
+
" Downloading dash_html_components-2.0.0-py3-none-any.whl (4.1 kB)\n",
|
43 |
+
"Collecting dash-core-components==2.0.0 (from dash)\n",
|
44 |
+
" Downloading dash_core_components-2.0.0-py3-none-any.whl (3.8 kB)\n",
|
45 |
+
"Collecting dash-table==5.0.0 (from dash)\n",
|
46 |
+
" Downloading dash_table-5.0.0-py3-none-any.whl (3.9 kB)\n",
|
47 |
+
"Requirement already satisfied: typing-extensions>=4.1.1 in /usr/local/lib/python3.10/dist-packages (from dash) (4.7.1)\n",
|
48 |
+
"Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (from dash) (2.31.0)\n",
|
49 |
+
"Collecting retrying (from dash)\n",
|
50 |
+
" Downloading retrying-1.3.4-py3-none-any.whl (11 kB)\n",
|
51 |
+
"Collecting ansi2html (from dash)\n",
|
52 |
+
" Downloading ansi2html-1.8.0-py3-none-any.whl (16 kB)\n",
|
53 |
+
"Requirement already satisfied: nest-asyncio in /usr/local/lib/python3.10/dist-packages (from dash) (1.5.7)\n",
|
54 |
+
"Requirement already satisfied: setuptools in /usr/local/lib/python3.10/dist-packages (from dash) (67.7.2)\n",
|
55 |
+
"Requirement already satisfied: Jinja2>=3.0 in /usr/local/lib/python3.10/dist-packages (from Flask<2.3.0,>=1.0.4->dash) (3.1.2)\n",
|
56 |
+
"Requirement already satisfied: itsdangerous>=2.0 in /usr/local/lib/python3.10/dist-packages (from Flask<2.3.0,>=1.0.4->dash) (2.1.2)\n",
|
57 |
+
"Requirement already satisfied: click>=8.0 in /usr/local/lib/python3.10/dist-packages (from Flask<2.3.0,>=1.0.4->dash) (8.1.7)\n",
|
58 |
+
"Requirement already satisfied: tenacity>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from plotly>=5.0.0->dash) (8.2.3)\n",
|
59 |
+
"Requirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from plotly>=5.0.0->dash) (23.1)\n",
|
60 |
+
"Requirement already satisfied: MarkupSafe>=2.1.1 in /usr/local/lib/python3.10/dist-packages (from Werkzeug<2.3.0->dash) (2.1.3)\n",
|
61 |
+
"Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests->dash) (3.2.0)\n",
|
62 |
+
"Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests->dash) (3.4)\n",
|
63 |
+
"Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests->dash) (2.0.4)\n",
|
64 |
+
"Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests->dash) (2023.7.22)\n",
|
65 |
+
"Requirement already satisfied: six>=1.7.0 in /usr/local/lib/python3.10/dist-packages (from retrying->dash) (1.16.0)\n",
|
66 |
+
"Installing collected packages: dash-table, dash-html-components, dash-core-components, Werkzeug, retrying, ansi2html, dash\n",
|
67 |
+
" Attempting uninstall: Werkzeug\n",
|
68 |
+
" Found existing installation: Werkzeug 2.3.7\n",
|
69 |
+
" Uninstalling Werkzeug-2.3.7:\n",
|
70 |
+
" Successfully uninstalled Werkzeug-2.3.7\n",
|
71 |
+
"Successfully installed Werkzeug-2.2.3 ansi2html-1.8.0 dash-2.13.0 dash-core-components-2.0.0 dash-html-components-2.0.0 dash-table-5.0.0 retrying-1.3.4\n",
|
72 |
+
"Collecting gradio\n",
|
73 |
+
" Downloading gradio-3.41.2-py3-none-any.whl (20.1 MB)\n",
|
74 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m20.1/20.1 MB\u001b[0m \u001b[31m47.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
75 |
+
"\u001b[?25hCollecting aiofiles<24.0,>=22.0 (from gradio)\n",
|
76 |
+
" Downloading aiofiles-23.2.1-py3-none-any.whl (15 kB)\n",
|
77 |
+
"Requirement already satisfied: altair<6.0,>=4.2.0 in /usr/local/lib/python3.10/dist-packages (from gradio) (4.2.2)\n",
|
78 |
+
"Collecting fastapi (from gradio)\n",
|
79 |
+
" Downloading fastapi-0.103.0-py3-none-any.whl (66 kB)\n",
|
80 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m66.2/66.2 kB\u001b[0m \u001b[31m6.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
81 |
+
"\u001b[?25hCollecting ffmpy (from gradio)\n",
|
82 |
+
" Downloading ffmpy-0.3.1.tar.gz (5.5 kB)\n",
|
83 |
+
" Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
|
84 |
+
"Collecting gradio-client==0.5.0 (from gradio)\n",
|
85 |
+
" Downloading gradio_client-0.5.0-py3-none-any.whl (298 kB)\n",
|
86 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m298.2/298.2 kB\u001b[0m \u001b[31m16.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
87 |
+
"\u001b[?25hCollecting httpx (from gradio)\n",
|
88 |
+
" Downloading httpx-0.24.1-py3-none-any.whl (75 kB)\n",
|
89 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m75.4/75.4 kB\u001b[0m \u001b[31m6.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
90 |
+
"\u001b[?25hCollecting huggingface-hub>=0.14.0 (from gradio)\n",
|
91 |
+
" Downloading huggingface_hub-0.16.4-py3-none-any.whl (268 kB)\n",
|
92 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m268.8/268.8 kB\u001b[0m \u001b[31m31.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
93 |
+
"\u001b[?25hRequirement already satisfied: importlib-resources<7.0,>=1.3 in /usr/local/lib/python3.10/dist-packages (from gradio) (6.0.1)\n",
|
94 |
+
"Requirement already satisfied: jinja2<4.0 in /usr/local/lib/python3.10/dist-packages (from gradio) (3.1.2)\n",
|
95 |
+
"Requirement already satisfied: markupsafe~=2.0 in /usr/local/lib/python3.10/dist-packages (from gradio) (2.1.3)\n",
|
96 |
+
"Requirement already satisfied: matplotlib~=3.0 in /usr/local/lib/python3.10/dist-packages (from gradio) (3.7.1)\n",
|
97 |
+
"Requirement already satisfied: numpy~=1.0 in /usr/local/lib/python3.10/dist-packages (from gradio) (1.23.5)\n",
|
98 |
+
"Collecting orjson~=3.0 (from gradio)\n",
|
99 |
+
" Downloading orjson-3.9.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (139 kB)\n",
|
100 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m139.9/139.9 kB\u001b[0m \u001b[31m17.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
101 |
+
"\u001b[?25hRequirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from gradio) (23.1)\n",
|
102 |
+
"Requirement already satisfied: pandas<3.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from gradio) (1.5.3)\n",
|
103 |
+
"Requirement already satisfied: pillow<11.0,>=8.0 in /usr/local/lib/python3.10/dist-packages (from gradio) (9.4.0)\n",
|
104 |
+
"Requirement already satisfied: pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,<3.0.0,>=1.7.4 in /usr/local/lib/python3.10/dist-packages (from gradio) (2.2.1)\n",
|
105 |
+
"Collecting pydub (from gradio)\n",
|
106 |
+
" Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB)\n",
|
107 |
+
"Collecting python-multipart (from gradio)\n",
|
108 |
+
" Downloading python_multipart-0.0.6-py3-none-any.whl (45 kB)\n",
|
109 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m45.7/45.7 kB\u001b[0m \u001b[31m5.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
110 |
+
"\u001b[?25hRequirement already satisfied: pyyaml<7.0,>=5.0 in /usr/local/lib/python3.10/dist-packages (from gradio) (6.0.1)\n",
|
111 |
+
"Requirement already satisfied: requests~=2.0 in /usr/local/lib/python3.10/dist-packages (from gradio) (2.31.0)\n",
|
112 |
+
"Collecting semantic-version~=2.0 (from gradio)\n",
|
113 |
+
" Downloading semantic_version-2.10.0-py2.py3-none-any.whl (15 kB)\n",
|
114 |
+
"Requirement already satisfied: typing-extensions~=4.0 in /usr/local/lib/python3.10/dist-packages (from gradio) (4.7.1)\n",
|
115 |
+
"Collecting uvicorn>=0.14.0 (from gradio)\n",
|
116 |
+
" Downloading uvicorn-0.23.2-py3-none-any.whl (59 kB)\n",
|
117 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m59.5/59.5 kB\u001b[0m \u001b[31m6.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
118 |
+
"\u001b[?25hCollecting websockets<12.0,>=10.0 (from gradio)\n",
|
119 |
+
" Downloading websockets-11.0.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (129 kB)\n",
|
120 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m129.9/129.9 kB\u001b[0m \u001b[31m16.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
121 |
+
"\u001b[?25hRequirement already satisfied: fsspec in /usr/local/lib/python3.10/dist-packages (from gradio-client==0.5.0->gradio) (2023.6.0)\n",
|
122 |
+
"Requirement already satisfied: entrypoints in /usr/local/lib/python3.10/dist-packages (from altair<6.0,>=4.2.0->gradio) (0.4)\n",
|
123 |
+
"Requirement already satisfied: jsonschema>=3.0 in /usr/local/lib/python3.10/dist-packages (from altair<6.0,>=4.2.0->gradio) (4.19.0)\n",
|
124 |
+
"Requirement already satisfied: toolz in /usr/local/lib/python3.10/dist-packages (from altair<6.0,>=4.2.0->gradio) (0.12.0)\n",
|
125 |
+
"Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.14.0->gradio) (3.12.2)\n",
|
126 |
+
"Requirement already satisfied: tqdm>=4.42.1 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.14.0->gradio) (4.66.1)\n",
|
127 |
+
"Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio) (1.1.0)\n",
|
128 |
+
"Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio) (0.11.0)\n",
|
129 |
+
"Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio) (4.42.1)\n",
|
130 |
+
"Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio) (1.4.4)\n",
|
131 |
+
"Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio) (3.1.1)\n",
|
132 |
+
"Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio) (2.8.2)\n",
|
133 |
+
"Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas<3.0,>=1.0->gradio) (2023.3)\n",
|
134 |
+
"Requirement already satisfied: annotated-types>=0.4.0 in /usr/local/lib/python3.10/dist-packages (from pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,<3.0.0,>=1.7.4->gradio) (0.5.0)\n",
|
135 |
+
"Requirement already satisfied: pydantic-core==2.6.1 in /usr/local/lib/python3.10/dist-packages (from pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,<3.0.0,>=1.7.4->gradio) (2.6.1)\n",
|
136 |
+
"Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio) (3.2.0)\n",
|
137 |
+
"Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio) (3.4)\n",
|
138 |
+
"Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio) (2.0.4)\n",
|
139 |
+
"Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio) (2023.7.22)\n",
|
140 |
+
"Requirement already satisfied: click>=7.0 in /usr/local/lib/python3.10/dist-packages (from uvicorn>=0.14.0->gradio) (8.1.7)\n",
|
141 |
+
"Collecting h11>=0.8 (from uvicorn>=0.14.0->gradio)\n",
|
142 |
+
" Downloading h11-0.14.0-py3-none-any.whl (58 kB)\n",
|
143 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m58.3/58.3 kB\u001b[0m \u001b[31m7.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
144 |
+
"\u001b[?25hCollecting starlette<0.28.0,>=0.27.0 (from fastapi->gradio)\n",
|
145 |
+
" Downloading starlette-0.27.0-py3-none-any.whl (66 kB)\n",
|
146 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m67.0/67.0 kB\u001b[0m \u001b[31m7.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
147 |
+
"\u001b[?25hCollecting httpcore<0.18.0,>=0.15.0 (from httpx->gradio)\n",
|
148 |
+
" Downloading httpcore-0.17.3-py3-none-any.whl (74 kB)\n",
|
149 |
+
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m74.5/74.5 kB\u001b[0m \u001b[31m9.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
150 |
+
"\u001b[?25hRequirement already satisfied: sniffio in /usr/local/lib/python3.10/dist-packages (from httpx->gradio) (1.3.0)\n",
|
151 |
+
"Requirement already satisfied: anyio<5.0,>=3.0 in /usr/local/lib/python3.10/dist-packages (from httpcore<0.18.0,>=0.15.0->httpx->gradio) (3.7.1)\n",
|
152 |
+
"Requirement already satisfied: attrs>=22.2.0 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio) (23.1.0)\n",
|
153 |
+
"Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio) (2023.7.1)\n",
|
154 |
+
"Requirement already satisfied: referencing>=0.28.4 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio) (0.30.2)\n",
|
155 |
+
"Requirement already satisfied: rpds-py>=0.7.1 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio) (0.9.2)\n",
|
156 |
+
"Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.7->matplotlib~=3.0->gradio) (1.16.0)\n",
|
157 |
+
"Requirement already satisfied: exceptiongroup in /usr/local/lib/python3.10/dist-packages (from anyio<5.0,>=3.0->httpcore<0.18.0,>=0.15.0->httpx->gradio) (1.1.3)\n",
|
158 |
+
"Building wheels for collected packages: ffmpy\n",
|
159 |
+
" Building wheel for ffmpy (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
|
160 |
+
" Created wheel for ffmpy: filename=ffmpy-0.3.1-py3-none-any.whl size=5579 sha256=2032dd8784fdbb8045cdb96c951ee65c67b09d9fcd8cefffdead131699da091f\n",
|
161 |
+
" Stored in directory: /root/.cache/pip/wheels/01/a6/d1/1c0828c304a4283b2c1639a09ad86f83d7c487ef34c6b4a1bf\n",
|
162 |
+
"Successfully built ffmpy\n",
|
163 |
+
"Installing collected packages: pydub, ffmpy, websockets, semantic-version, python-multipart, orjson, h11, aiofiles, uvicorn, starlette, huggingface-hub, httpcore, httpx, fastapi, gradio-client, gradio\n",
|
164 |
+
"Successfully installed aiofiles-23.2.1 fastapi-0.103.0 ffmpy-0.3.1 gradio-3.41.2 gradio-client-0.5.0 h11-0.14.0 httpcore-0.17.3 httpx-0.24.1 huggingface-hub-0.16.4 orjson-3.9.5 pydub-0.25.1 python-multipart-0.0.6 semantic-version-2.10.0 starlette-0.27.0 uvicorn-0.23.2 websockets-11.0.3\n"
|
165 |
+
]
|
166 |
+
}
|
167 |
+
],
|
168 |
+
"source": [
|
169 |
+
"\n",
|
170 |
+
"import numpy as np\n",
|
171 |
+
"!pip install dash\n",
|
172 |
+
"!pip install gradio\n",
|
173 |
+
"from dash import Dash, html, dcc, callback, Output, Input\n",
|
174 |
+
"import plotly.express as px\n",
|
175 |
+
"import pandas as pd\n",
|
176 |
+
"\n",
|
177 |
+
"import gradio\n",
|
178 |
+
"\n",
|
179 |
+
"\n"
|
180 |
+
]
|
181 |
+
},
|
182 |
+
{
|
183 |
+
"cell_type": "code",
|
184 |
+
"source": [
|
185 |
+
"import plotly.graph_objects as go"
|
186 |
+
],
|
187 |
+
"metadata": {
|
188 |
+
"id": "UTT-vjWhSfb1"
|
189 |
+
},
|
190 |
+
"execution_count": 9,
|
191 |
+
"outputs": []
|
192 |
+
},
|
193 |
+
{
|
194 |
+
"cell_type": "code",
|
195 |
+
"source": [
|
196 |
+
"taraf_s = pd.read_csv('/content/drive/MyDrive/Hadith Project/taraf_by_year.csv')"
|
197 |
+
],
|
198 |
+
"metadata": {
|
199 |
+
"id": "aQ7A9JuO5OXG"
|
200 |
+
},
|
201 |
+
"execution_count": 3,
|
202 |
+
"outputs": []
|
203 |
+
},
|
204 |
+
{
|
205 |
+
"cell_type": "code",
|
206 |
+
"source": [
|
207 |
+
"taraf_s = taraf_s.sort_values(['City', 'Year'], ascending=True)"
|
208 |
+
],
|
209 |
+
"metadata": {
|
210 |
+
"id": "LQXxkbkb5ORG"
|
211 |
+
},
|
212 |
+
"execution_count": 4,
|
213 |
+
"outputs": []
|
214 |
+
},
|
215 |
+
{
|
216 |
+
"cell_type": "code",
|
217 |
+
"source": [
|
218 |
+
"cities = taraf_s['City'].unique().tolist()\n",
|
219 |
+
"min_year = int(taraf_s['Year'].min())\n",
|
220 |
+
"max_year = int(taraf_s['Year'].max())\n"
|
221 |
+
],
|
222 |
+
"metadata": {
|
223 |
+
"id": "CfOMDUskb-rm"
|
224 |
+
},
|
225 |
+
"execution_count": 5,
|
226 |
+
"outputs": []
|
227 |
+
},
|
228 |
+
{
|
229 |
+
"cell_type": "code",
|
230 |
+
"source": [
|
231 |
+
"citi = ['Ψ§ΩΩ
Ψ―ΩΩΩ', 'Ψ¨ΨΊΨ―Ψ§Ψ―', 'ΩΩΩΨ©', 'Ψ¨Ψ΅Ψ±Ψ©']\n",
|
232 |
+
"min_year = 0\n",
|
233 |
+
"max_year = 400\n",
|
234 |
+
"filtered = taraf_s[taraf_s['City'].isin(citi) & (taraf_s['Year'] >= min_year) & (taraf_s['Year'] <= max_year)]"
|
235 |
+
],
|
236 |
+
"metadata": {
|
237 |
+
"id": "-tUrcfrRoI02"
|
238 |
+
},
|
239 |
+
"execution_count": 8,
|
240 |
+
"outputs": []
|
241 |
+
},
|
242 |
+
{
|
243 |
+
"cell_type": "code",
|
244 |
+
"source": [
|
245 |
+
"def plot_timeline(citi = ['Ψ§ΩΩ
Ψ―ΩΩΩ', 'Ψ¨ΨΊΨ―Ψ§Ψ―', 'ΩΩΩΨ©', 'Ψ¨Ψ΅Ψ±Ψ©'], min_year = 0, max_year = 400):\n",
|
246 |
+
" filtered = taraf_s[taraf_s['City'].isin(citi) & (taraf_s['Year'] >= min_year) & (taraf_s['Year'] <= max_year)]\n",
|
247 |
+
" fig = px.line(data_frame = filtered, x = 'Year', y = 'Taraf', title = \"Tarafs per Year\", color = 'City' )\n",
|
248 |
+
" fig.update_layout(title_font_color = 'red', title_x = .5)\n",
|
249 |
+
"\n",
|
250 |
+
"\n",
|
251 |
+
"\n",
|
252 |
+
" return fig\n",
|
253 |
+
"\n"
|
254 |
+
],
|
255 |
+
"metadata": {
|
256 |
+
"id": "VSa6g0LS5OMt"
|
257 |
+
},
|
258 |
+
"execution_count": 6,
|
259 |
+
"outputs": []
|
260 |
+
},
|
261 |
+
{
|
262 |
+
"cell_type": "code",
|
263 |
+
"source": [
|
264 |
+
"app = gradio.Interface(plot_timeline,\n",
|
265 |
+
" [gradio.Dropdown(choices = cities, value = ['Ψ§ΩΩ
Ψ―ΩΩΩ', 'Ψ¨ΨΊΨ―Ψ§Ψ―', 'ΩΩΩΨ©', 'Ψ¨Ψ΅Ψ±Ψ©'], multiselect=True),\n",
|
266 |
+
" gradio.Slider(min_year, max_year, value = 0, label = 'Begining', info = 'Choose the first year to display Tarafs'),\n",
|
267 |
+
" gradio.Slider(min_year, max_year, value = 400, label = 'End', info = 'Choose the last year to display Tarafs')\n",
|
268 |
+
"\n",
|
269 |
+
" ],\n",
|
270 |
+
" gradio.Plot()).launch(share = True)\n"
|
271 |
+
],
|
272 |
+
"metadata": {
|
273 |
+
"colab": {
|
274 |
+
"base_uri": "https://localhost:8080/",
|
275 |
+
"height": 610
|
276 |
+
},
|
277 |
+
"id": "hd0ah4OMYaQ3",
|
278 |
+
"outputId": "9310de1b-3f6e-4f55-ad9a-bb725a0c1b59"
|
279 |
+
},
|
280 |
+
"execution_count": null,
|
281 |
+
"outputs": [
|
282 |
+
{
|
283 |
+
"output_type": "stream",
|
284 |
+
"name": "stdout",
|
285 |
+
"text": [
|
286 |
+
"Colab notebook detected. To show errors in colab notebook, set debug=True in launch()\n",
|
287 |
+
"Running on public URL: https://18e75bd7c5e6808eae.gradio.live\n",
|
288 |
+
"\n",
|
289 |
+
"This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n"
|
290 |
+
]
|
291 |
+
},
|
292 |
+
{
|
293 |
+
"output_type": "display_data",
|
294 |
+
"data": {
|
295 |
+
"text/plain": [
|
296 |
+
"<IPython.core.display.HTML object>"
|
297 |
+
],
|
298 |
+
"text/html": [
|
299 |
+
"<div><iframe src=\"https://18e75bd7c5e6808eae.gradio.live\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
|
300 |
+
]
|
301 |
+
},
|
302 |
+
"metadata": {}
|
303 |
+
}
|
304 |
+
]
|
305 |
+
}
|
306 |
+
]
|
307 |
+
}
|