-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
141 lines (119 loc) · 6.24 KB
/
app.py
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
from src.utils import *
from src.Processor import Processor
#TODO add logging for each application
def main():
if len(st.session_state) == 0:
initSessionState()
app = st.sidebar.selectbox(
"Which application would you like to use?",
(
"🏠Home Page",
"🔎Face Detection",
"🎭Face Recognition",
"📊Facial Attribute Analysis",
"👃Face Parsing",
"🌌Landmark Extraction",
"📐Head Pose Estimation",
"🎛️ControlNet Operations"
)
)
if app == "🏠Home Page":
st.title("OneStopVision")
st.write("The following list are the applications you can use here. You can access the applications here from the sidebar on the left.")
col1, col2 = st.columns(2)
with col1:
st.subheader("🔎Face Detection")
st.write("Effortlessly pinpoint human faces in any image.")
st.subheader("🎭Face Recognition")
st.write("Unmask the identity behind the face with lightning-fast recognition.")
st.subheader("📊Facial Attribute Analysis")
st.write("See beyond the surface - analyze facial features to understand gender, age, and emotional state.")
st.subheader("👃Face Parsing")
st.write("Dissect the face with precision, segmenting features like eyes, nose, and mouth.")
with col2:
st.subheader("🌌Landmark Extraction")
st.write("Capture the intricate details of the face with 68 key landmarks.")
st.subheader("📐Head Pose Estimation")
st.write("Determine the precise orientation and tilt of a person's head.")
st.subheader("🎛️ControlNet Operations")
st.write("Unlock powerful image manipulation tools like Canny edge detection, M-LSD line segmentation etc. - all within your control.")
elif app == "🔎Face Detection":
if (st.session_state.Processor is None):
st.session_state.currentApp = app
st.session_state.Processor = Processor()
st.session_state.Processor.initNecessaryModels()
elif (st.session_state.currentApp is not app):
clearSession()
st.session_state.currentApp = app
st.session_state.Processor.deleteUnnecessaryModels()
st.session_state.Processor.initNecessaryModels()
st.session_state.Processor.pipelineFaceDetection()
elif app == "🎭Face Recognition":
if (st.session_state.Processor is None) and (st.session_state.currentApp is not app):
st.session_state.currentApp = app
st.session_state.Processor = Processor()
st.session_state.Processor.initNecessaryModels()
elif (st.session_state.currentApp is not app):
clearSession()
st.session_state.currentApp = app
st.session_state.Processor.deleteUnnecessaryModels()
st.session_state.Processor.initNecessaryModels()
st.session_state.Processor.pipelineFaceRecognition()
elif app == "📊Facial Attribute Analysis":
if (st.session_state.Processor is None) and (st.session_state.currentApp is not app):
st.session_state.currentApp = app
st.session_state.Processor = Processor()
st.session_state.Processor.initNecessaryModels()
elif (st.session_state.currentApp is not app):
clearSession()
st.session_state.currentApp = app
st.session_state.Processor.deleteUnnecessaryModels()
st.session_state.Processor.initNecessaryModels()
st.session_state.Processor.pipelineFacialAttributeAnalysis()
elif app == "👃Face Parsing":
if (st.session_state.Processor is None) and (st.session_state.currentApp is not app):
st.session_state.currentApp = app
st.session_state.Processor = Processor()
st.session_state.Processor.initNecessaryModels()
elif (st.session_state.currentApp is not app):
clearSession()
st.session_state.currentApp = app
st.session_state.Processor.deleteUnnecessaryModels()
st.session_state.Processor.initNecessaryModels()
st.session_state.Processor.pipelineFaceParsing()
elif app == "🌌Landmark Extraction":
if (st.session_state.Processor is None) and (st.session_state.currentApp is not app):
st.session_state.currentApp = app
st.session_state.Processor = Processor()
st.session_state.Processor.initNecessaryModels()
elif (st.session_state.currentApp is not app):
clearSession()
st.session_state.currentApp = app
st.session_state.Processor.deleteUnnecessaryModels()
st.session_state.Processor.initNecessaryModels()
st.session_state.Processor.pipelineLandmarkExtraction()
elif app == "📐Head Pose Estimation":
if (st.session_state.Processor is None) and (st.session_state.currentApp is not app):
st.session_state.currentApp = app
st.session_state.Processor = Processor()
st.session_state.Processor.initNecessaryModels()
elif (st.session_state.currentApp is not app):
clearSession()
st.session_state.currentApp = app
st.session_state.Processor.deleteUnnecessaryModels()
st.session_state.Processor.initNecessaryModels()
st.session_state.Processor.pipelineHeadPoseEstimation()
elif app == "🎛️ControlNet Operations":
if (st.session_state.Processor is None) and (st.session_state.currentApp is not app):
st.session_state.currentApp = app
st.session_state.Processor = Processor()
st.session_state.Processor.initNecessaryModels()
elif (st.session_state.currentApp is not app):
clearSession()
st.session_state.currentApp = app
st.session_state.Processor.deleteUnnecessaryModels()
st.session_state.Processor.initNecessaryModels()
st.session_state.Processor.pipelineControlNetOperations()
else:
pass
main()