File size: 2,094 Bytes
d84b5d5
 
bb44b48
d84b5d5
af8a4e4
d84b5d5
0dd565d
dfd844f
c5d63c6
d8f634f
71b19e1
46bb033
 
3c3a6af
0dd565d
 
 
d8f634f
 
3c3a6af
de55297
0646b3c
06b119c
04a7e14
 
d8f634f
 
 
 
 
7c4249a
d8f634f
0646b3c
0dd565d
 
 
 
 
 
 
0646b3c
0dd565d
9347ebd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
import cv2
import gradio as gr

from channel_functions import individual_channel_image_final, individual_channel_image, channel_distribution_plotter, which_channel_dominates
description1 = '''This tab shows which channel dominates which part of an image\n
Upload an image or drag an online image to the upload section. Bring it to the rectangular area. Release it when the border becomes red'''

original_image_plot = gr.Radio(['yes','no'], label = "Do you want the original image be plotted in the background?")
original_image_opacity = gr.Slider(0,1, value = 0.3, label = "Opacity of the original image")
channel_opacity = gr.Slider(0,1, value = 0.7, label = "Opacity of the output channel-domination image")


individual_channel_choice = gr.Radio(['Red','Green','Blue', 'All'], label = 'Which channel do you want to see the image in?')

iface1 = gr.Interface(
                      fn = which_channel_dominates, 
                      inputs = [gr.Image(), original_image_plot, original_image_opacity, channel_opacity],
                      outputs = "image", 
                      title="Channel domination", 
                      description=description1,
                     )

iface2 = gr.Interface(
                     fn = channel_distribution_plotter, 
                     inputs = gr.Image(),
                     outputs = "image",
                     title = "Distribution of pixel counts in all channels",
                     description = 'Something random'
                     )

iface3 = gr.Interface(
                    fn = individual_channel_image_final,
                    inputs = [gr.Image(), individual_channel_choice],
                    outputs = "image"    ,
                    title = "Images in individual channels",
                    description = "Something random"
                    )

combinedInterface = gr.TabbedInterface([iface1, iface2, iface3],['Channel domination', 'Channel distribution', "Individual channel"])
combinedInterface.launch(share=False)