import gradio as gr import torch from visual_clutter import Vlc def inference(img): clt = Vlc(img.name, numlevels=3, contrast_filt_sigma=1, contrast_pool_sigma=3, color_pool_sigma=3, prefix='test') # get Feature Congestion clutter of a test map: clutter_scalar_fc, clutter_map_fc = clt.getClutter_FC(p=1, pix=1) # get Subband Entropy clutter of the test map: clutter_scalar_se = clt.getClutter_SE(wlevels=3, wght_chrom=0.0625) return ['test_collapsed_combine_map.png', str(clutter_scalar_fc), str(clutter_scalar_se)] title = 'Visual Clutter' description = 'Compute two measures of visual clutter (Feature Congestion and Subband Entropy)' article = "
" examples = [['test.jpg'],['test2.jpg']] css = ".output_image, .input_image {height: 40rem !important; width: 100% !important;}" gr.Interface( inference, [gr.inputs.Image(type='file', label='Input')], [gr.outputs.Image(type='file', label='Feature Congestion Output Image'), gr.outputs.Textbox(type="str", label="Feature Congestion"), gr.outputs.Textbox(type="str", label="Subband Entorpy")], title=title, description=description, article=article, examples=examples, css=css, ).launch(debug=True, enable_queue=True)