forked from amineHY/WebApp-Computer-Vision-streamlit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
executable file
·53 lines (39 loc) · 1.37 KB
/
main.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
#------------------------------------------------------#
# Import librairies
#------------------------------------------------------#
import datetime
import urllib
import time
import cv2 as cv
import streamlit as st
from libraries.plugins import Motion_Detection
from libraries.utils import GUI, AppManager, DataManager
#------------------------------------------------------#
#------------------------------------------------------#
def imageWebApp(guiParam):
"""
"""
# Load the image according to the selected option
conf = DataManager(guiParam)
image = conf.load_image_or_video()
# GUI
switchProcessing = st.button('* Start Processing *')
# Apply the selected plugin on the image
bboxed_frame, output = AppManager(guiParam).process(image, True)
# Display results
st.image(bboxed_frame, channels="BGR", use_column_width=True)
def main():
"""
"""
# Get the parameter entered by the user from the GUI
guiParam = GUI().getGuiParameters()
# Check if the application if it is Empty
if guiParam['appType'] == 'Image Applications':
if guiParam["selectedApp"] is not 'Empty':
imageWebApp(guiParam)
else:
raise st.ScriptRunner.StopException
#------------------------------------------------------#
#------------------------------------------------------#
if __name__ == "__main__":
main()