umyuu commited on
Commit
4d72cd8
·
1 Parent(s): 22a27a1

Google colab対応

Browse files

rename launch.py app.py

Files changed (4) hide show
  1. README.md +4 -3
  2. src/launch.py → app.py +0 -0
  3. launch_app.ipynb +230 -0
  4. run.bat +1 -1
README.md CHANGED
@@ -1,6 +1,7 @@
1
  <div align="center">
2
 
3
- ![Python version](https://img.shields.io/badge/python-3.8+-important)
 
4
  </div>
5
 
6
  # SaliencyMap — in Python
@@ -29,9 +30,9 @@ run.bat
29
  > **NOTE**
30
  > デフォルトポート番号は、9999です。
31
  > アプリが起動せずポート番号を変更する時は、メモ帳で`run.bat`を開きの以下行の9999を別の数字(8888)などに変更し保存してください。
32
- > python src\launch.py --server_port 9999
33
  > REM 変更後
34
- > python src\launch.py --server_port 8888
35
 
36
  ## 補足事項
37
  - ローカルで処理が完結します。画像を外部には送信しません。
 
1
  <div align="center">
2
 
3
+ ![Python version](https://img.shields.io/badge/python-3.8+-important) |
4
+ <a href="https://colab.research.google.com/github/umyuu/SaliencyMapDemo/blob/main/launch_app.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
5
  </div>
6
 
7
  # SaliencyMap — in Python
 
30
  > **NOTE**
31
  > デフォルトポート番号は、9999です。
32
  > アプリが起動せずポート番号を変更する時は、メモ帳で`run.bat`を開きの以下行の9999を別の数字(8888)などに変更し保存してください。
33
+ > python app.py --server_port 9999
34
  > REM 変更後
35
+ > python app.py --server_port 8888
36
 
37
  ## 補足事項
38
  - ローカルで処理が完結します。画像を外部には送信しません。
src/launch.py → app.py RENAMED
File without changes
launch_app.ipynb ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "nbformat": 4,
3
+ "nbformat_minor": 0,
4
+ "metadata": {
5
+ "colab": {
6
+ "provenance": [],
7
+ "toc_visible": true
8
+ },
9
+ "kernelspec": {
10
+ "name": "python3",
11
+ "display_name": "Python 3"
12
+ },
13
+ "language_info": {
14
+ "name": "python"
15
+ }
16
+ },
17
+ "cells": [
18
+ {
19
+ "cell_type": "markdown",
20
+ "source": [
21
+ "# アプリのインストール"
22
+ ],
23
+ "metadata": {
24
+ "id": "QBBnZWaddxv4"
25
+ }
26
+ },
27
+ {
28
+ "cell_type": "code",
29
+ "source": [
30
+ "%cd /content"
31
+ ],
32
+ "metadata": {
33
+ "colab": {
34
+ "base_uri": "https://localhost:8080/"
35
+ },
36
+ "id": "7a5Rf_Qee3N1",
37
+ "outputId": "719bb077-fd14-4761-fb37-ad2aa86c17d8"
38
+ },
39
+ "execution_count": 35,
40
+ "outputs": [
41
+ {
42
+ "output_type": "stream",
43
+ "name": "stdout",
44
+ "text": [
45
+ "/content\n"
46
+ ]
47
+ }
48
+ ]
49
+ },
50
+ {
51
+ "cell_type": "code",
52
+ "execution_count": 36,
53
+ "metadata": {
54
+ "colab": {
55
+ "base_uri": "https://localhost:8080/"
56
+ },
57
+ "id": "fYM7KJOfdPuK",
58
+ "outputId": "31d665dc-e159-4e2c-f1a2-05a6a6a39ea0"
59
+ },
60
+ "outputs": [
61
+ {
62
+ "output_type": "stream",
63
+ "name": "stdout",
64
+ "text": [
65
+ "fatal: destination path 'SaliencyMapDemo' already exists and is not an empty directory.\n"
66
+ ]
67
+ }
68
+ ],
69
+ "source": [
70
+ "!git clone https://github.com/umyuu/SaliencyMapDemo.git"
71
+ ]
72
+ },
73
+ {
74
+ "cell_type": "code",
75
+ "source": [
76
+ "%cd SaliencyMapDemo"
77
+ ],
78
+ "metadata": {
79
+ "colab": {
80
+ "base_uri": "https://localhost:8080/"
81
+ },
82
+ "id": "H0HI3iKRenJB",
83
+ "outputId": "67e4274d-cb65-4f75-b1ae-e79a6fe953a2"
84
+ },
85
+ "execution_count": 40,
86
+ "outputs": [
87
+ {
88
+ "output_type": "stream",
89
+ "name": "stdout",
90
+ "text": [
91
+ "/content/SaliencyMapDemo/SaliencyMapDemo\n"
92
+ ]
93
+ }
94
+ ]
95
+ },
96
+ {
97
+ "cell_type": "code",
98
+ "execution_count": 41,
99
+ "metadata": {
100
+ "colab": {
101
+ "base_uri": "https://localhost:8080/"
102
+ },
103
+ "id": "UxrRgQpmDK_g",
104
+ "outputId": "ff72156f-9b3e-42ed-9b21-95de1d83ad2a"
105
+ },
106
+ "outputs": [
107
+ {
108
+ "output_type": "stream",
109
+ "name": "stdout",
110
+ "text": [
111
+ "Requirement already satisfied: aiofiles==23.2.1 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 1)) (23.2.1)\n",
112
+ "Requirement already satisfied: altair==5.3.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 2)) (5.3.0)\n",
113
+ "Requirement already satisfied: annotated-types==0.6.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 3)) (0.6.0)\n",
114
+ "Requirement already satisfied: anyio==4.3.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 4)) (4.3.0)\n",
115
+ "Requirement already satisfied: attrs==23.2.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 5)) (23.2.0)\n",
116
+ "Requirement already satisfied: certifi==2024.2.2 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 6)) (2024.2.2)\n",
117
+ "Requirement already satisfied: charset-normalizer==3.3.2 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 7)) (3.3.2)\n",
118
+ "Requirement already satisfied: click==8.1.7 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 8)) (8.1.7)\n",
119
+ "Requirement already satisfied: colorama==0.4.6 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 9)) (0.4.6)\n",
120
+ "Requirement already satisfied: contourpy==1.2.1 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 10)) (1.2.1)\n",
121
+ "Requirement already satisfied: cycler==0.12.1 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 11)) (0.12.1)\n",
122
+ "Requirement already satisfied: dnspython==2.6.1 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 12)) (2.6.1)\n",
123
+ "Requirement already satisfied: email_validator==2.1.1 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 13)) (2.1.1)\n",
124
+ "Requirement already satisfied: exceptiongroup==1.2.1 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 14)) (1.2.1)\n",
125
+ "Requirement already satisfied: fastapi==0.111.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 15)) (0.111.0)\n",
126
+ "Requirement already satisfied: fastapi-cli==0.0.2 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 16)) (0.0.2)\n",
127
+ "Requirement already satisfied: ffmpy==0.3.2 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 17)) (0.3.2)\n",
128
+ "Requirement already satisfied: filelock==3.14.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 18)) (3.14.0)\n",
129
+ "Requirement already satisfied: fonttools==4.51.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 19)) (4.51.0)\n",
130
+ "Requirement already satisfied: fsspec==2024.3.1 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 20)) (2024.3.1)\n",
131
+ "Requirement already satisfied: gradio==4.28.3 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 21)) (4.28.3)\n",
132
+ "Requirement already satisfied: gradio_client==0.16.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 22)) (0.16.0)\n",
133
+ "Requirement already satisfied: h11==0.14.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 23)) (0.14.0)\n",
134
+ "Requirement already satisfied: httpcore==1.0.5 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 24)) (1.0.5)\n",
135
+ "Requirement already satisfied: httptools==0.6.1 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 25)) (0.6.1)\n",
136
+ "Requirement already satisfied: httpx==0.27.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 26)) (0.27.0)\n",
137
+ "Requirement already satisfied: huggingface-hub==0.23.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 27)) (0.23.0)\n",
138
+ "Requirement already satisfied: idna==3.7 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 28)) (3.7)\n",
139
+ "Requirement already satisfied: importlib_resources==6.4.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 29)) (6.4.0)\n",
140
+ "Requirement already satisfied: Jinja2==3.1.3 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 30)) (3.1.3)\n",
141
+ "Requirement already satisfied: jsonschema==4.22.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 31)) (4.22.0)\n",
142
+ "Requirement already satisfied: jsonschema-specifications==2023.12.1 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 32)) (2023.12.1)\n",
143
+ "Requirement already satisfied: kiwisolver==1.4.5 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 33)) (1.4.5)\n",
144
+ "Requirement already satisfied: markdown-it-py==3.0.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 34)) (3.0.0)\n",
145
+ "Requirement already satisfied: MarkupSafe==2.1.5 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 35)) (2.1.5)\n",
146
+ "Requirement already satisfied: matplotlib==3.8.4 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 36)) (3.8.4)\n",
147
+ "Requirement already satisfied: mdurl==0.1.2 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 37)) (0.1.2)\n",
148
+ "Requirement already satisfied: numpy==1.26.4 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 38)) (1.26.4)\n",
149
+ "Requirement already satisfied: opencv-python==4.9.0.80 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 39)) (4.9.0.80)\n",
150
+ "Requirement already satisfied: opencv-contrib-python==4.9.0.80 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 40)) (4.9.0.80)\n",
151
+ "Requirement already satisfied: orjson==3.10.2 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 41)) (3.10.2)\n",
152
+ "Requirement already satisfied: packaging==24.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 42)) (24.0)\n",
153
+ "Requirement already satisfied: pandas==2.2.2 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 43)) (2.2.2)\n",
154
+ "Requirement already satisfied: pillow==10.3.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 44)) (10.3.0)\n",
155
+ "Requirement already satisfied: pydantic==2.7.1 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 45)) (2.7.1)\n",
156
+ "Requirement already satisfied: pydantic_core==2.18.2 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 46)) (2.18.2)\n",
157
+ "Requirement already satisfied: pydub==0.25.1 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 47)) (0.25.1)\n",
158
+ "Requirement already satisfied: Pygments==2.17.2 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 48)) (2.17.2)\n",
159
+ "Requirement already satisfied: pyparsing==3.1.2 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 49)) (3.1.2)\n",
160
+ "Requirement already satisfied: python-dateutil==2.9.0.post0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 50)) (2.9.0.post0)\n",
161
+ "Requirement already satisfied: python-dotenv==1.0.1 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 51)) (1.0.1)\n",
162
+ "Requirement already satisfied: python-multipart==0.0.9 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 52)) (0.0.9)\n",
163
+ "Requirement already satisfied: pytz==2024.1 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 53)) (2024.1)\n",
164
+ "Requirement already satisfied: PyYAML==6.0.1 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 54)) (6.0.1)\n",
165
+ "Requirement already satisfied: referencing==0.35.1 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 55)) (0.35.1)\n",
166
+ "Requirement already satisfied: requests==2.31.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 56)) (2.31.0)\n",
167
+ "Requirement already satisfied: rich==13.7.1 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 57)) (13.7.1)\n",
168
+ "Requirement already satisfied: rpds-py==0.18.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 58)) (0.18.0)\n",
169
+ "Requirement already satisfied: ruff==0.4.2 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 59)) (0.4.2)\n",
170
+ "Requirement already satisfied: semantic-version==2.10.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 60)) (2.10.0)\n",
171
+ "Requirement already satisfied: shellingham==1.5.4 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 61)) (1.5.4)\n",
172
+ "Requirement already satisfied: six==1.16.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 62)) (1.16.0)\n",
173
+ "Requirement already satisfied: sniffio==1.3.1 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 63)) (1.3.1)\n",
174
+ "Requirement already satisfied: starlette==0.37.2 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 64)) (0.37.2)\n",
175
+ "Requirement already satisfied: tomlkit==0.12.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 65)) (0.12.0)\n",
176
+ "Requirement already satisfied: toolz==0.12.1 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 66)) (0.12.1)\n",
177
+ "Requirement already satisfied: tqdm==4.66.4 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 67)) (4.66.4)\n",
178
+ "Requirement already satisfied: typer==0.12.3 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 68)) (0.12.3)\n",
179
+ "Requirement already satisfied: typing_extensions==4.11.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 69)) (4.11.0)\n",
180
+ "Requirement already satisfied: tzdata==2024.1 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 70)) (2024.1)\n",
181
+ "Requirement already satisfied: ujson==5.9.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 71)) (5.9.0)\n",
182
+ "Requirement already satisfied: urllib3==2.2.1 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 72)) (2.2.1)\n",
183
+ "Requirement already satisfied: uvicorn==0.29.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 73)) (0.29.0)\n",
184
+ "Requirement already satisfied: watchfiles==0.21.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 74)) (0.21.0)\n",
185
+ "Requirement already satisfied: websockets==11.0.3 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 75)) (11.0.3)\n",
186
+ "Requirement already satisfied: uvloop!=0.15.0,!=0.15.1,>=0.14.0 in /usr/local/lib/python3.10/dist-packages (from uvicorn==0.29.0->-r requirements.txt (line 73)) (0.19.0)\n"
187
+ ]
188
+ }
189
+ ],
190
+ "source": [
191
+ "!pip install -r requirements.txt"
192
+ ]
193
+ },
194
+ {
195
+ "cell_type": "markdown",
196
+ "source": [
197
+ "# 実行"
198
+ ],
199
+ "metadata": {
200
+ "id": "LUcp4xt2fJU9"
201
+ }
202
+ },
203
+ {
204
+ "cell_type": "code",
205
+ "source": [
206
+ "!python app.py --share True"
207
+ ],
208
+ "metadata": {
209
+ "colab": {
210
+ "base_uri": "https://localhost:8080/"
211
+ },
212
+ "id": "J3kKmi6Rd95n",
213
+ "outputId": "f6d09c36-8603-4ff6-fb34-f72497dcc0ff"
214
+ },
215
+ "execution_count": 39,
216
+ "outputs": [
217
+ {
218
+ "output_type": "stream",
219
+ "name": "stdout",
220
+ "text": [
221
+ "Traceback (most recent call last):\n",
222
+ " File \"/content/SaliencyMapDemo/app.py\", line 12, in <module>\n",
223
+ " import utils\n",
224
+ "ModuleNotFoundError: No module named 'utils'\n"
225
+ ]
226
+ }
227
+ ]
228
+ }
229
+ ]
230
+ }
run.bat CHANGED
@@ -2,6 +2,6 @@
2
 
3
  cd %~dp0
4
  call venv\Scripts\activate
5
- python src\launch.py --server_port 9999
6
 
7
  TIMEOUT /T 10
 
2
 
3
  cd %~dp0
4
  call venv\Scripts\activate
5
+ python app.py --server_port 9999
6
 
7
  TIMEOUT /T 10