narugo1992
dev(narugo): upload chsex models
21e723b
raw
history blame
4.8 kB
import os
import gradio as gr
from aicheck import _gr_aicheck, _DEFAULT_AICHECK_MODEL, _AICHECK_MODELS
from chsex import _gr_chsex, _CHSEX_MODELS, _DEFAULT_CHSEX_MODEL
from cls import _CLS_MODELS, _DEFAULT_CLS_MODEL, _gr_classification
from monochrome import _gr_monochrome, _DEFAULT_MONO_MODEL, _MONO_MODELS
from rating import _RATING_MODELS, _DEFAULT_RATING_MODEL, _gr_rating
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],
)
with gr.Tab('Monochrome'):
with gr.Row():
with gr.Column():
gr_mono_input_image = gr.Image(type='pil', label='Original Image')
gr_mono_model = gr.Dropdown(_MONO_MODELS, value=_DEFAULT_MONO_MODEL, label='Model')
gr_mono_infer_size = gr.Slider(224, 640, value=384, step=32, label='Infer Size')
gr_mono_submit = gr.Button(value='Submit', variant='primary')
with gr.Column():
gr_mono_output = gr.Label(label='Classes')
gr_mono_submit.click(
_gr_monochrome,
inputs=[gr_mono_input_image, gr_mono_model, gr_mono_infer_size],
outputs=[gr_mono_output],
)
with gr.Tab('AI Check'):
with gr.Row():
with gr.Column():
gr_aicheck_input_image = gr.Image(type='pil', label='Original Image')
gr_aicheck_model = gr.Dropdown(_AICHECK_MODELS, value=_DEFAULT_AICHECK_MODEL, label='Model')
gr_aicheck_infer_size = gr.Slider(224, 640, value=384, step=32, label='Infer Size')
gr_aicheck_submit = gr.Button(value='Submit', variant='primary')
with gr.Column():
gr_aicheck_output = gr.Label(label='Classes')
gr_aicheck_submit.click(
_gr_aicheck,
inputs=[gr_aicheck_input_image, gr_aicheck_model, gr_aicheck_infer_size],
outputs=[gr_aicheck_output],
)
with gr.Tab('Rating'):
with gr.Row():
with gr.Column():
gr_rating_input_image = gr.Image(type='pil', label='Original Image')
gr_rating_model = gr.Dropdown(_RATING_MODELS, value=_DEFAULT_RATING_MODEL, label='Model')
gr_rating_infer_size = gr.Slider(224, 640, value=384, step=32, label='Infer Size')
gr_rating_submit = gr.Button(value='Submit', variant='primary')
with gr.Column():
gr_rating_output = gr.Label(label='Classes')
gr_rating_submit.click(
_gr_rating,
inputs=[gr_rating_input_image, gr_rating_model, gr_rating_infer_size],
outputs=[gr_rating_output],
)
with gr.Tab('Character Sex'):
with gr.Row():
with gr.Column():
gr_chsex_input_image = gr.Image(type='pil', label='Original Image')
gr_chsex_model = gr.Dropdown(_CHSEX_MODELS, value=_DEFAULT_CHSEX_MODEL, label='Model')
gr_chsex_infer_size = gr.Slider(224, 640, value=384, step=32, label='Infer Size')
gr_chsex_submit = gr.Button(value='Submit', variant='primary')
with gr.Column():
gr_chsex_output = gr.Label(label='Classes')
gr_chsex_submit.click(
_gr_chsex,
inputs=[gr_chsex_input_image, gr_chsex_model, gr_chsex_infer_size],
outputs=[gr_chsex_output],
)
demo.queue(os.cpu_count()).launch()