HawkeyeHS commited on
Commit
3f834bf
1 Parent(s): 34a6a75

Add application file

Browse files
Files changed (2) hide show
  1. app.py +44 -0
  2. requirements.txt +136 -0
app.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from deepforest import main
3
+ import cv2
4
+
5
+
6
+ def show_trees(img_path):
7
+ model = main.deepforest()
8
+ model.use_release()
9
+ img = model.predict_image(path=img_path, return_plot=True)
10
+ img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
11
+ return img
12
+
13
+ def show_birds(img_path):
14
+ model = main.deepforest()
15
+ model.use_bird_release()
16
+ img = model.predict_image(path=img_path, return_plot=True)
17
+ img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
18
+ return img
19
+
20
+ with gr.Blocks() as demo:
21
+ gr.Markdown('# Deepforest')
22
+ gr.Markdown('## Tree Detection Model')
23
+ gr.Markdown('### Predict trees')
24
+ with gr.Row():
25
+ with gr.Column():
26
+ input_image = gr.Image(label="Input Image", type="filepath")
27
+ with gr.Column():
28
+ output_image = gr.Image(label="Predicted image")
29
+
30
+ submit_button_trees = gr.Button("Predict trees")
31
+ submit_button_trees.click(show_trees, inputs=input_image, outputs=output_image)
32
+
33
+ gr.Markdown('### Predict birds')
34
+ with gr.Row():
35
+ with gr.Column():
36
+ input_image=gr.Image(label="Input image",type="filepath")
37
+ with gr.Column():
38
+ output_image=gr.Image(label="Predicted Image")
39
+
40
+ submit_button_birds = gr.Button("Predict birds")
41
+ submit_button_birds.click(show_birds,inputs=input_image,outputs=output_image)
42
+
43
+ if __name__ == "__main__":
44
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ affine @ file:///Users/ktietz/demo/mc3/conda-bld/affine_1629890479180/work
2
+ aiofiles==23.2.1
3
+ aiohttp==3.9.3
4
+ aiosignal==1.3.1
5
+ alabaster==0.7.16
6
+ albumentations==1.4.2
7
+ altair==5.2.0
8
+ annotated-types==0.6.0
9
+ anyio==4.3.0
10
+ attrs @ file:///croot/attrs_1695717823297/work
11
+ Babel==2.14.0
12
+ certifi @ file:///croot/certifi_1707229174982/work/certifi
13
+ charset-normalizer==3.3.2
14
+ click @ file:///croot/click_1698129812380/work
15
+ click-plugins @ file:///Users/ktietz/demo/mc3/conda-bld/click-plugins_1630665883852/work
16
+ cligj==0.7.2
17
+ colorama==0.4.6
18
+ commonmark==0.9.1
19
+ contourpy==1.2.0
20
+ cycler==0.12.1
21
+ docutils==0.20.1
22
+ fastapi==0.110.0
23
+ ffmpy==0.3.2
24
+ filelock==3.13.3
25
+ fiona==1.9.6
26
+ fonttools==4.50.0
27
+ frozenlist==1.4.1
28
+ fsspec==2024.3.1
29
+ geopandas==0.14.3
30
+ gradio==4.23.0
31
+ gradio_client==0.14.0
32
+ h11==0.14.0
33
+ httpcore==1.0.4
34
+ httpx==0.27.0
35
+ huggingface-hub==0.22.1
36
+ idna==3.6
37
+ imagecodecs==2024.1.1
38
+ imageio==2.34.0
39
+ imagesize==1.4.1
40
+ importlib_resources==6.4.0
41
+ Jinja2==3.1.3
42
+ joblib==1.3.2
43
+ jsonschema==4.21.1
44
+ jsonschema-specifications==2023.12.1
45
+ kiwisolver==1.4.5
46
+ lazy_loader==0.3
47
+ lightning-utilities==0.11.1
48
+ markdown-it-py==3.0.0
49
+ MarkupSafe==2.1.5
50
+ matplotlib==3.8.3
51
+ mdurl==0.1.2
52
+ mkl-fft @ file:///croot/mkl_fft_1695058164594/work
53
+ mkl-random @ file:///croot/mkl_random_1695059800811/work
54
+ mkl-service==2.4.0
55
+ mpmath==1.3.0
56
+ multidict==6.0.5
57
+ networkx==3.2.1
58
+ numpy @ file:///croot/numpy_and_numpy_base_1708638617955/work/dist/numpy-1.26.4-cp311-cp311-linux_x86_64.whl#sha256=5f96f274d410a1682519282ae769c877d32fdbf171aa8badec7bf5e1d3a1748a
59
+ nvidia-cublas-cu12==12.1.3.1
60
+ nvidia-cuda-cupti-cu12==12.1.105
61
+ nvidia-cuda-nvrtc-cu12==12.1.105
62
+ nvidia-cuda-runtime-cu12==12.1.105
63
+ nvidia-cudnn-cu12==8.9.2.26
64
+ nvidia-cufft-cu12==11.0.2.54
65
+ nvidia-curand-cu12==10.3.2.106
66
+ nvidia-cusolver-cu12==11.4.5.107
67
+ nvidia-cusparse-cu12==12.1.0.106
68
+ nvidia-nccl-cu12==2.19.3
69
+ nvidia-nvjitlink-cu12==12.4.99
70
+ nvidia-nvtx-cu12==12.1.105
71
+ opencv-python==4.9.0.80
72
+ opencv-python-headless==4.9.0.80
73
+ orjson==3.9.15
74
+ packaging==24.0
75
+ pandas==2.2.1
76
+ pillow==10.2.0
77
+ progressbar2==4.4.2
78
+ psutil==5.9.8
79
+ pycocotools==2.0.7
80
+ pydantic==2.6.4
81
+ pydantic_core==2.16.3
82
+ pydub==0.25.1
83
+ Pygments==2.17.2
84
+ pyparsing @ file:///work/ci_py311/pyparsing_1677811559502/work
85
+ pyproj==3.6.1
86
+ python-dateutil==2.9.0.post0
87
+ python-multipart==0.0.9
88
+ python-utils==3.8.2
89
+ pytorch-lightning==2.2.1
90
+ pytz==2024.1
91
+ PyYAML==6.0.1
92
+ rasterio @ file:///work/ci_py311/rasterio_1676861695610/work
93
+ recommonmark==0.7.1
94
+ referencing==0.34.0
95
+ requests==2.31.0
96
+ rich==13.7.1
97
+ rpds-py==0.18.0
98
+ Rtree==1.2.0
99
+ ruff==0.3.4
100
+ scikit-image==0.22.0
101
+ scikit-learn==1.4.1.post1
102
+ scipy==1.12.0
103
+ semantic-version==2.10.0
104
+ shapely==2.0.3
105
+ shellingham==1.5.4
106
+ six==1.16.0
107
+ slidingwindow==0.0.14
108
+ sniffio==1.3.1
109
+ snowballstemmer==2.2.0
110
+ snuggs @ file:///Users/ktietz/demo/mc3/conda-bld/snuggs_1629803886966/work
111
+ Sphinx==7.2.6
112
+ sphinxcontrib-applehelp==1.0.8
113
+ sphinxcontrib-devhelp==1.0.6
114
+ sphinxcontrib-htmlhelp==2.0.5
115
+ sphinxcontrib-jsmath==1.0.1
116
+ sphinxcontrib-qthelp==1.0.7
117
+ sphinxcontrib-serializinghtml==1.1.10
118
+ starlette==0.36.3
119
+ sympy==1.12
120
+ threadpoolctl==3.4.0
121
+ tifffile==2024.2.12
122
+ tomlkit==0.12.0
123
+ toolz==0.12.1
124
+ torch==2.2.1
125
+ torchmetrics==1.3.2
126
+ torchvision==0.17.1
127
+ tqdm==4.66.2
128
+ triton==2.2.0
129
+ typer==0.10.0
130
+ typing_extensions==4.10.0
131
+ tzdata==2024.1
132
+ urllib3==2.2.1
133
+ uvicorn==0.29.0
134
+ websockets==11.0.3
135
+ xmltodict==0.13.0
136
+ yarl==1.9.4