yigewu
commited on
Commit
β’
2717522
1
Parent(s):
6f740ba
added model file
Browse files- app.ipynb +183 -0
- app.py +1 -1
- donut_model.pkl +3 -0
app.ipynb
ADDED
@@ -0,0 +1,183 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": 1,
|
6 |
+
"metadata": {},
|
7 |
+
"outputs": [
|
8 |
+
{
|
9 |
+
"name": "stdout",
|
10 |
+
"output_type": "stream",
|
11 |
+
"text": [
|
12 |
+
"Collecting gradio\n",
|
13 |
+
" Downloading gradio-3.6-py3-none-any.whl (5.3 MB)\n",
|
14 |
+
"\u001b[K |ββββββββββββββββββββββββββββββββ| 5.3 MB 3.8 MB/s eta 0:00:01\n",
|
15 |
+
"\u001b[?25hRequirement already satisfied: pandas in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from gradio) (1.4.2)\n",
|
16 |
+
"Collecting paramiko\n",
|
17 |
+
" Downloading paramiko-2.11.0-py2.py3-none-any.whl (212 kB)\n",
|
18 |
+
"\u001b[K |ββββββββββββββββββββββββββββββββ| 212 kB 25.4 MB/s eta 0:00:01\n",
|
19 |
+
"\u001b[?25hRequirement already satisfied: pyyaml in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from gradio) (6.0)\n",
|
20 |
+
"Collecting uvicorn\n",
|
21 |
+
" Downloading uvicorn-0.19.0-py3-none-any.whl (56 kB)\n",
|
22 |
+
"\u001b[K |ββββββββββββββββββββββββββββββββ| 56 kB 15.3 MB/s eta 0:00:01\n",
|
23 |
+
"\u001b[?25hCollecting fastapi\n",
|
24 |
+
" Downloading fastapi-0.85.1-py3-none-any.whl (55 kB)\n",
|
25 |
+
"\u001b[K |ββββββββββββββββββββββββββββββββ| 55 kB 16.2 MB/s eta 0:00:01\n",
|
26 |
+
"\u001b[?25hRequirement already satisfied: aiohttp in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from gradio) (3.8.1)\n",
|
27 |
+
"Collecting pycryptodome\n",
|
28 |
+
" Downloading pycryptodome-3.15.0-cp35-abi3-macosx_10_9_x86_64.whl (1.6 MB)\n",
|
29 |
+
"\u001b[K |ββββββββββββββββββββββββββββββββ| 1.6 MB 95.4 MB/s eta 0:00:01\n",
|
30 |
+
"\u001b[?25hCollecting h11<0.13,>=0.11\n",
|
31 |
+
" Downloading h11-0.12.0-py3-none-any.whl (54 kB)\n",
|
32 |
+
"\u001b[K |ββββββββββββββββββββββββββββββββ| 54 kB 9.5 MB/s eta 0:00:01\n",
|
33 |
+
"\u001b[?25hRequirement already satisfied: numpy in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from gradio) (1.21.5)\n",
|
34 |
+
"Collecting httpx\n",
|
35 |
+
" Downloading httpx-0.23.0-py3-none-any.whl (84 kB)\n",
|
36 |
+
"\u001b[K |ββββββββββββββββββββββββββββββββ| 84 kB 11.8 MB/s eta 0:00:01\n",
|
37 |
+
"\u001b[?25hCollecting markdown-it-py[linkify,plugins]\n",
|
38 |
+
" Downloading markdown_it_py-2.1.0-py3-none-any.whl (84 kB)\n",
|
39 |
+
"\u001b[K |ββββββββββββββββββββββββββββββββ| 84 kB 12.8 MB/s eta 0:00:01\n",
|
40 |
+
"\u001b[?25hRequirement already satisfied: matplotlib in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from gradio) (3.5.1)\n",
|
41 |
+
"Collecting orjson\n",
|
42 |
+
" Downloading orjson-3.8.0-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (483 kB)\n",
|
43 |
+
"\u001b[K |ββββββββββββββββββββββββββββββββ| 483 kB 19.1 MB/s eta 0:00:01\n",
|
44 |
+
"\u001b[?25hRequirement already satisfied: requests in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from gradio) (2.27.1)\n",
|
45 |
+
"Requirement already satisfied: fsspec in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from gradio) (2022.2.0)\n",
|
46 |
+
"Requirement already satisfied: pillow in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from gradio) (9.0.1)\n",
|
47 |
+
"Collecting pydantic\n",
|
48 |
+
" Downloading pydantic-1.10.2-cp39-cp39-macosx_10_9_x86_64.whl (3.2 MB)\n",
|
49 |
+
"\u001b[K |ββββββββββββββββββββββββββββββββ| 3.2 MB 24.8 MB/s eta 0:00:01\n",
|
50 |
+
"\u001b[?25hRequirement already satisfied: jinja2 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from gradio) (2.11.3)\n",
|
51 |
+
"Collecting ffmpy\n",
|
52 |
+
" Downloading ffmpy-0.3.0.tar.gz (4.8 kB)\n",
|
53 |
+
"Collecting python-multipart\n",
|
54 |
+
" Downloading python-multipart-0.0.5.tar.gz (32 kB)\n",
|
55 |
+
"Collecting pydub\n",
|
56 |
+
" Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB)\n",
|
57 |
+
"Collecting websockets\n",
|
58 |
+
" Downloading websockets-10.3-cp39-cp39-macosx_10_9_x86_64.whl (97 kB)\n",
|
59 |
+
"\u001b[K |ββββββββββββββββββββββββββββββββ| 97 kB 14.0 MB/s eta 0:00:01\n",
|
60 |
+
"\u001b[?25hRequirement already satisfied: aiosignal>=1.1.2 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from aiohttp->gradio) (1.2.0)\n",
|
61 |
+
"Requirement already satisfied: multidict<7.0,>=4.5 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from aiohttp->gradio) (5.2.0)\n",
|
62 |
+
"Requirement already satisfied: yarl<2.0,>=1.0 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from aiohttp->gradio) (1.6.3)\n",
|
63 |
+
"Requirement already satisfied: attrs>=17.3.0 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from aiohttp->gradio) (21.4.0)\n",
|
64 |
+
"Requirement already satisfied: frozenlist>=1.1.1 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from aiohttp->gradio) (1.2.0)\n",
|
65 |
+
"Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from aiohttp->gradio) (4.0.1)\n",
|
66 |
+
"Requirement already satisfied: charset-normalizer<3.0,>=2.0 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from aiohttp->gradio) (2.0.4)\n",
|
67 |
+
"Requirement already satisfied: typing-extensions>=3.6.5 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from async-timeout<5.0,>=4.0.0a3->aiohttp->gradio) (4.1.1)\n",
|
68 |
+
"Requirement already satisfied: idna>=2.0 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from yarl<2.0,>=1.0->aiohttp->gradio) (3.3)\n",
|
69 |
+
"Collecting starlette==0.20.4\n",
|
70 |
+
" Downloading starlette-0.20.4-py3-none-any.whl (63 kB)\n",
|
71 |
+
"\u001b[K |ββββββββββββββββββββββββββββββββ| 63 kB 8.9 MB/s eta 0:00:01\n",
|
72 |
+
"\u001b[?25hRequirement already satisfied: anyio<5,>=3.4.0 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from starlette==0.20.4->fastapi->gradio) (3.5.0)\n",
|
73 |
+
"Requirement already satisfied: sniffio>=1.1 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from anyio<5,>=3.4.0->starlette==0.20.4->fastapi->gradio) (1.2.0)\n",
|
74 |
+
"Requirement already satisfied: certifi in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from httpx->gradio) (2021.10.8)\n",
|
75 |
+
"Collecting rfc3986[idna2008]<2,>=1.3\n",
|
76 |
+
" Downloading rfc3986-1.5.0-py2.py3-none-any.whl (31 kB)\n",
|
77 |
+
"Collecting httpcore<0.16.0,>=0.15.0\n",
|
78 |
+
" Downloading httpcore-0.15.0-py3-none-any.whl (68 kB)\n",
|
79 |
+
"\u001b[K |ββββββββββββββββββββββββββββββββ| 68 kB 22.0 MB/s eta 0:00:01\n",
|
80 |
+
"\u001b[?25hRequirement already satisfied: MarkupSafe>=0.23 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from jinja2->gradio) (2.0.1)\n",
|
81 |
+
"Collecting mdurl~=0.1\n",
|
82 |
+
" Downloading mdurl-0.1.2-py3-none-any.whl (10.0 kB)\n",
|
83 |
+
"Collecting mdit-py-plugins\n",
|
84 |
+
" Downloading mdit_py_plugins-0.3.1-py3-none-any.whl (46 kB)\n",
|
85 |
+
"\u001b[K |ββββββββββββββββββββββββββββββββ| 46 kB 15.9 MB/s eta 0:00:01\n",
|
86 |
+
"\u001b[?25hCollecting linkify-it-py~=1.0\n",
|
87 |
+
" Downloading linkify_it_py-1.0.3-py3-none-any.whl (19 kB)\n",
|
88 |
+
"Collecting uc-micro-py\n",
|
89 |
+
" Downloading uc_micro_py-1.0.1-py3-none-any.whl (6.2 kB)\n",
|
90 |
+
"Requirement already satisfied: pyparsing>=2.2.1 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from matplotlib->gradio) (3.0.4)\n",
|
91 |
+
"Requirement already satisfied: cycler>=0.10 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from matplotlib->gradio) (0.11.0)\n",
|
92 |
+
"Requirement already satisfied: kiwisolver>=1.0.1 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from matplotlib->gradio) (1.3.2)\n",
|
93 |
+
"Requirement already satisfied: packaging>=20.0 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from matplotlib->gradio) (21.3)\n",
|
94 |
+
"Requirement already satisfied: python-dateutil>=2.7 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from matplotlib->gradio) (2.8.2)\n",
|
95 |
+
"Requirement already satisfied: fonttools>=4.22.0 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from matplotlib->gradio) (4.25.0)\n",
|
96 |
+
"Requirement already satisfied: six>=1.5 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from python-dateutil>=2.7->matplotlib->gradio) (1.16.0)\n",
|
97 |
+
"Requirement already satisfied: pytz>=2020.1 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from pandas->gradio) (2021.3)\n",
|
98 |
+
"Collecting pynacl>=1.0.1\n",
|
99 |
+
" Downloading PyNaCl-1.5.0-cp36-abi3-macosx_10_10_universal2.whl (349 kB)\n",
|
100 |
+
"\u001b[K |ββββββββββββββββββββββββββββββββ| 349 kB 15.8 MB/s eta 0:00:01\n",
|
101 |
+
"\u001b[?25hRequirement already satisfied: bcrypt>=3.1.3 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from paramiko->gradio) (3.2.0)\n",
|
102 |
+
"Requirement already satisfied: cryptography>=2.5 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from paramiko->gradio) (3.4.8)\n",
|
103 |
+
"Requirement already satisfied: cffi>=1.1 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from bcrypt>=3.1.3->paramiko->gradio) (1.15.0)\n",
|
104 |
+
"Requirement already satisfied: pycparser in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from cffi>=1.1->bcrypt>=3.1.3->paramiko->gradio) (2.21)\n",
|
105 |
+
"Requirement already satisfied: urllib3<1.27,>=1.21.1 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from requests->gradio) (1.26.9)\n",
|
106 |
+
"Requirement already satisfied: click>=7.0 in /Users/dinglab/opt/anaconda3/lib/python3.9/site-packages (from uvicorn->gradio) (8.0.4)\n",
|
107 |
+
"Building wheels for collected packages: ffmpy, python-multipart\n",
|
108 |
+
" Building wheel for ffmpy (setup.py) ... \u001b[?25ldone\n",
|
109 |
+
"\u001b[?25h Created wheel for ffmpy: filename=ffmpy-0.3.0-py3-none-any.whl size=4712 sha256=51dd2d770517fb8d6fbde09ce138e4f739e1b5cde0ceaf79360170d436984e38\n",
|
110 |
+
" Stored in directory: /Users/dinglab/Library/Caches/pip/wheels/91/e2/96/f676aa08bfd789328c6576cd0f1fde4a3d686703bb0c247697\n",
|
111 |
+
" Building wheel for python-multipart (setup.py) ... \u001b[?25ldone\n",
|
112 |
+
"\u001b[?25h Created wheel for python-multipart: filename=python_multipart-0.0.5-py3-none-any.whl size=31678 sha256=1003fb9bd410d535b246e156b16f4cd2f0ff15995dbf4d175865d59765170d7f\n",
|
113 |
+
" Stored in directory: /Users/dinglab/Library/Caches/pip/wheels/fe/04/d1/a10661cc45f03c3cecda50deb2d2c22f57b4e84a75b2a5987e\n",
|
114 |
+
"Successfully built ffmpy python-multipart\n",
|
115 |
+
"Installing collected packages: mdurl, uc-micro-py, rfc3986, markdown-it-py, h11, starlette, pynacl, pydantic, mdit-py-plugins, linkify-it-py, httpcore, websockets, uvicorn, python-multipart, pydub, pycryptodome, paramiko, orjson, httpx, ffmpy, fastapi, gradio\n",
|
116 |
+
"Successfully installed fastapi-0.85.1 ffmpy-0.3.0 gradio-3.6 h11-0.12.0 httpcore-0.15.0 httpx-0.23.0 linkify-it-py-1.0.3 markdown-it-py-2.1.0 mdit-py-plugins-0.3.1 mdurl-0.1.2 orjson-3.8.0 paramiko-2.11.0 pycryptodome-3.15.0 pydantic-1.10.2 pydub-0.25.1 pynacl-1.5.0 python-multipart-0.0.5 rfc3986-1.5.0 starlette-0.20.4 uc-micro-py-1.0.1 uvicorn-0.19.0 websockets-10.3\n"
|
117 |
+
]
|
118 |
+
}
|
119 |
+
],
|
120 |
+
"source": [
|
121 |
+
"#|default_exp app\n",
|
122 |
+
"!pip install gradio"
|
123 |
+
]
|
124 |
+
},
|
125 |
+
{
|
126 |
+
"cell_type": "code",
|
127 |
+
"execution_count": 2,
|
128 |
+
"metadata": {},
|
129 |
+
"outputs": [
|
130 |
+
{
|
131 |
+
"ename": "ModuleNotFoundError",
|
132 |
+
"evalue": "No module named 'fastai'",
|
133 |
+
"output_type": "error",
|
134 |
+
"traceback": [
|
135 |
+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
136 |
+
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
|
137 |
+
"Cell \u001b[0;32mIn [2], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[39m#|export\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mfastai\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mvision\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mall\u001b[39;00m \u001b[39mimport\u001b[39;00m \u001b[39m*\u001b[39m\n\u001b[1;32m 3\u001b[0m \u001b[39mimport\u001b[39;00m \u001b[39mgradio\u001b[39;00m \u001b[39mas\u001b[39;00m \u001b[39mgr\u001b[39;00m\n",
|
138 |
+
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'fastai'"
|
139 |
+
]
|
140 |
+
}
|
141 |
+
],
|
142 |
+
"source": [
|
143 |
+
"#|export\n",
|
144 |
+
"from fastai.vision.all import *\n",
|
145 |
+
"import gradio as gr"
|
146 |
+
]
|
147 |
+
},
|
148 |
+
{
|
149 |
+
"cell_type": "code",
|
150 |
+
"execution_count": null,
|
151 |
+
"metadata": {},
|
152 |
+
"outputs": [],
|
153 |
+
"source": []
|
154 |
+
}
|
155 |
+
],
|
156 |
+
"metadata": {
|
157 |
+
"kernelspec": {
|
158 |
+
"display_name": "Python 3.9.6 64-bit",
|
159 |
+
"language": "python",
|
160 |
+
"name": "python3"
|
161 |
+
},
|
162 |
+
"language_info": {
|
163 |
+
"codemirror_mode": {
|
164 |
+
"name": "ipython",
|
165 |
+
"version": 3
|
166 |
+
},
|
167 |
+
"file_extension": ".py",
|
168 |
+
"mimetype": "text/x-python",
|
169 |
+
"name": "python",
|
170 |
+
"nbconvert_exporter": "python",
|
171 |
+
"pygments_lexer": "ipython3",
|
172 |
+
"version": "3.9.6"
|
173 |
+
},
|
174 |
+
"orig_nbformat": 4,
|
175 |
+
"vscode": {
|
176 |
+
"interpreter": {
|
177 |
+
"hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
|
178 |
+
}
|
179 |
+
}
|
180 |
+
},
|
181 |
+
"nbformat": 4,
|
182 |
+
"nbformat_minor": 2
|
183 |
+
}
|
app.py
CHANGED
@@ -4,4 +4,4 @@ def greet(name):
|
|
4 |
return "Hello " + name + "!!"
|
5 |
|
6 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
7 |
-
iface.launch()
|
|
|
4 |
return "Hello " + name + "!!"
|
5 |
|
6 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
7 |
+
iface.launch()
|
donut_model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c2f49dab6871874af51e46fb0047286a4f49606de4c25250b11d357af943eae9
|
3 |
+
size 46956203
|