Spaces:
Sleeping
Sleeping
import os | |
import gradio as gr | |
from cls import _CLS_MODELS, _DEFAULT_CLS_MODEL, _gr_classification | |
if __name__ == '__main__': | |
with gr.Blocks() as demo: | |
with gr.Tabs(): | |
with gr.Tab('Classification'): | |
with gr.Row(): | |
with gr.Column(): | |
gr_cls_input_image = gr.Image(type='pil', label='Original Image') | |
gr_cls_model = gr.Dropdown(_CLS_MODELS, value=_DEFAULT_CLS_MODEL, label='Model') | |
gr_cls_infer_size = gr.Slider(224, 640, value=384, step=32, label='Infer Size') | |
gr_cls_submit = gr.Button(value='Submit', variant='primary') | |
with gr.Column(): | |
gr_cls_output = gr.Label(label='Classes') | |
gr_cls_submit.click( | |
_gr_classification, | |
inputs=[gr_cls_input_image, gr_cls_model, gr_cls_infer_size], | |
outputs=[gr_cls_output], | |
) | |
demo.queue(os.cpu_count()).launch() | |