Spaces:
Running
Running
umyuu
commited on
Commit
·
232a35a
1
Parent(s):
a3a4c65
BooleanOptionalActionを使用する。
Browse filesPython 3.8 で追加
https://docs.python.org/3/library/argparse.html#action
- app.py +4 -4
- launch_app.ipynb +1 -1
- run.bat +1 -1
app.py
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
"""
|
3 |
SaliencyMapDemo
|
4 |
"""
|
5 |
-
import
|
6 |
|
7 |
import src.utils as utils
|
8 |
from src.reporter import get_current_reporter
|
@@ -22,11 +22,11 @@ def main():
|
|
22 |
|
23 |
from src.myapp import runApp
|
24 |
|
25 |
-
parser =
|
26 |
parser.add_argument('--server_port', type=int, default=7860, help="Gradio server port")
|
27 |
parser.add_argument('--max_file_size', type=int, default=20 * 1024 * 1024, help="Gradio max file size")
|
28 |
-
parser.add_argument('--inbrowser',
|
29 |
-
parser.add_argument('--share',
|
30 |
parser.add_argument('--version', action='version', version=f'%(prog)s {__version__}')
|
31 |
|
32 |
args = parser.parse_args()
|
|
|
2 |
"""
|
3 |
SaliencyMapDemo
|
4 |
"""
|
5 |
+
from argparse import ArgumentParser, BooleanOptionalAction
|
6 |
|
7 |
import src.utils as utils
|
8 |
from src.reporter import get_current_reporter
|
|
|
22 |
|
23 |
from src.myapp import runApp
|
24 |
|
25 |
+
parser = ArgumentParser(prog=PROGRAM_NAME, description="SaliencyMapDemo")
|
26 |
parser.add_argument('--server_port', type=int, default=7860, help="Gradio server port")
|
27 |
parser.add_argument('--max_file_size', type=int, default=20 * 1024 * 1024, help="Gradio max file size")
|
28 |
+
parser.add_argument('--inbrowser', action=BooleanOptionalAction, default=True, help="Gradio inbrowser")
|
29 |
+
parser.add_argument('--share', action=BooleanOptionalAction, default=False, help="Gradio share")
|
30 |
parser.add_argument('--version', action='version', version=f'%(prog)s {__version__}')
|
31 |
|
32 |
args = parser.parse_args()
|
launch_app.ipynb
CHANGED
@@ -279,7 +279,7 @@
|
|
279 |
{
|
280 |
"cell_type": "code",
|
281 |
"source": [
|
282 |
-
"!python app.py --share
|
283 |
],
|
284 |
"metadata": {
|
285 |
"colab": {
|
|
|
279 |
{
|
280 |
"cell_type": "code",
|
281 |
"source": [
|
282 |
+
"!python app.py --share"
|
283 |
],
|
284 |
"metadata": {
|
285 |
"colab": {
|
run.bat
CHANGED
@@ -4,4 +4,4 @@ cd %~dp0
|
|
4 |
call venv\Scripts\activate
|
5 |
python app.py --server_port 9999
|
6 |
|
7 |
-
TIMEOUT /T 10
|
|
|
4 |
call venv\Scripts\activate
|
5 |
python app.py --server_port 9999
|
6 |
|
7 |
+
TIMEOUT /T 10
|