File size: 3,539 Bytes
30d1897
ce444b0
03605b3
30d1897
0007cbf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e74527f
204dc88
03605b3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ce444b0
d23d9bc
e74527f
03605b3
 
d23d9bc
079a30f
 
 
03605b3
d23d9bc
079a30f
 
 
03605b3
079a30f
 
d23d9bc
2dbb6fc
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import gradio as gr
from input_manager import run_inference, latest_conf_matrix, latest_labels
import pandas as pd

color_map_dict = {
    "Dictyopteris polypodioides": "#FF5733",
    "Zonaria tournefortii": "#DAF7A6",
    "Peyssonnelia sp.": "#581845",
    "Sargassum vulgare": "#C70039",
    "Crambe crambe": "#FFC300",
    "Stones and Pebbles": "#900C3F",
    "Sand": "#FF5733",
    "Scalarispongia scalaris": "#DAF7A6",
    "Jania rubens": "#581845",
    "Hard bed and rock": "#C70039",
    "Hermodice carunculata": "#FFC300",
    "Posidonia oceanica": "#900C3F",
    "Coarse sand": "#58D68D",
    "Sarcotragus spinosulus": "#E74C3C",
    "Centrostephanus longispinus": "#2E86C1",
    "CCS": "#7D3C98",
    "Protula sp.": "#B03A2E",
    "Lithophyllum incrustans": "#2874A6",
    "Halophila stipulacea": "#239B56",
    "Asparagopsis taxiformis": "#D35400",
    "Padina pavonica": "#7E5109",
    "Cymodocea nodosa": "#1E8449",
    "Liagora viscida": "#9A7D0A",
    "Lophocladia lallemandii": "#1ABC9C",
    "Dictyota dichotoma": "#D98880",
    "Chondrilla nucula": "#FAD7A0",
    "Ulva compressa": "#D7BDE2"
}

iface = gr.Interface(
    fn=run_inference,
    inputs=[gr.Image(label="Image to Evaluate"),
            gr.Dropdown(label="Depth",choices=["Unknown","Less than 30m","Less than 90m","Less than 150m"], value="Unknown"),
            gr.Textbox(label="CSV Input (Paste CSV Contents Here)", lines=10, value='''Species Present,Seagrasses,Algal Communities,Biogenic reef,Coarse Sand,Rock
Posidonia oceanica,100,0,0,0,0
Cymodocea nodosa,100,0,0,0,0
Asparagopsis taxiformis,0,80,20,0,0
Liagora viscida,0,80,20,0,0
Lophocladia lallemandii,30,60,10,0,0
Peyssonnelia sp.,0,10,50,0,40
Lithophyllum incrustans,0,0,70,0,30
Jania rubens,0,90,10,0,0
Codium bursa,0,50,20,10,20
Ulva compressa,0,50,30,0,20
Dictyopteris polypodioides,0,60,30,0,10
Dictyota dichotoma,0,60,20,0,20
Padina pavonica,0,40,20,20,20
Sargassum vulgare,0,70,10,10,10
Zonaria tournefortii,0,60,30,0,10
Chondrilla nucula,0,0,90,0,10
Sarcotragus spinosulus,0,10,70,0,20
Scalarispongia scalaris,0,10,70,0,20
Hermodice carunculata,10,10,40,10,30
Centrostephanus longispinus,0,0,50,0,50
Crambe crambe,0,0,50,0,50
Protula sp.,0,0,50,0,50
Sand,0,0,0,100,0
Hard bed and rock,0,0,0,0,100
Stones and Pebbles,0,0,0,0,20
Maximum Depth,40,90,90,150,150''')],
    outputs=[gr.Textbox(label="Execution duration"),
             gr.Annotatedimage(label="Interactive Object Detection",color_map=color_map_dict),
             gr.DataFrame(label="Predicted Benthic Habitat",headers=["Prediction", "Confidence"]),
             gr.DataFrame(label="Habitat Confidence Values",headers=["Classification", "Confidence"]),
             gr.Image(label="Instance Segmentation Result"),
             gr.DataFrame(label="Identified Classes Confidence Values",headers=["Classification", "Confidence"])],
    description="Last updated: 8th May 2024",
    title= "AMBULANT Benthic Habitat Identification System",
)
conf_matrix_img = gr.Image(latest_conf_matrix, label="Latest Model")
labels_img = gr.Image(latest_labels, label="Latest Model")

f = open('docs/changelog.html', 'r')
changelog_data = f.read()
f.close()
changelog = gr.HTML(value=changelog_data)

f = open('docs/bugreports.html', 'r')
bugs_data = f.read()
f.close()
bugs = gr.HTML(value=bugs_data)

ifacepro = gr.TabbedInterface(interface_list=[iface, conf_matrix_img,labels_img,changelog,bugs], tab_names=["Test Environment", "Normalised Confusion Matrix", "Total Class Instances", "Changelog", "Bug Reporting"])

ifacepro.launch(share=True)