haritsahm
commited on
Commit
·
963ab1e
1
Parent(s):
7b85432
Add examples to main app
Browse files
main.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
from pathlib import Path
|
2 |
from typing import List
|
3 |
|
@@ -24,6 +25,10 @@ OUTPUT_GALLERY = gr.Gallery(
|
|
24 |
label='Highlighted Area').style(grid=[2], height='auto')
|
25 |
SUPPORTED_IMG_EXT = ['.png', '.jpg', '.jpeg']
|
26 |
|
|
|
|
|
|
|
|
|
27 |
|
28 |
def filter_files(files: List) -> List:
|
29 |
"""Filter uploaded files.
|
@@ -178,7 +183,8 @@ def run():
|
|
178 |
demo = gr.Interface(
|
179 |
fn=predict_bilateral,
|
180 |
inputs=gr.File(file_count='multiple', file_types=SUPPORTED_IMG_EXT),
|
181 |
-
outputs=[OUTPUT_GALLERY, gr.Label(label='Cancer Type')]
|
|
|
182 |
)
|
183 |
|
184 |
demo.launch(server_name='0.0.0.0', server_port=7860) # nosec B104
|
|
|
1 |
+
import os
|
2 |
from pathlib import Path
|
3 |
from typing import List
|
4 |
|
|
|
25 |
label='Highlighted Area').style(grid=[2], height='auto')
|
26 |
SUPPORTED_IMG_EXT = ['.png', '.jpg', '.jpeg']
|
27 |
|
28 |
+
EXAMPLE_IMAGES = [
|
29 |
+
os.path.join(os.path.dirname(__file__), f'examples/{f}')
|
30 |
+
for f in os.listdir('examples/')]
|
31 |
+
|
32 |
|
33 |
def filter_files(files: List) -> List:
|
34 |
"""Filter uploaded files.
|
|
|
183 |
demo = gr.Interface(
|
184 |
fn=predict_bilateral,
|
185 |
inputs=gr.File(file_count='multiple', file_types=SUPPORTED_IMG_EXT),
|
186 |
+
outputs=[OUTPUT_GALLERY, gr.Label(label='Cancer Type')],
|
187 |
+
examples=EXAMPLE_IMAGES,
|
188 |
)
|
189 |
|
190 |
demo.launch(server_name='0.0.0.0', server_port=7860) # nosec B104
|