Spaces:
Running
Running
Add Streamlit application for real-time OpenCV exploration
Browse files- Introduced app.py to implement a web interface for exploring various OpenCV filters and transformations using webcam input.
- Updated .gitignore to include Python cache files.
- Removed run.py as it is no longer needed for launching the application.
- .gitignore +7 -0
- src/streamlit_app.py β app.py +1 -1
- run.py +0 -42
- src/opencv_utils.py +2 -2
.gitignore
CHANGED
@@ -4,3 +4,10 @@
|
|
4 |
.streamlit
|
5 |
.streamlit/secrets.toml
|
6 |
.streamlit/secrets.toml
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
.streamlit
|
5 |
.streamlit/secrets.toml
|
6 |
.streamlit/secrets.toml
|
7 |
+
__pycache__
|
8 |
+
*.pyc
|
9 |
+
*.pyo
|
10 |
+
*.pyd
|
11 |
+
*.pyw
|
12 |
+
*.pyz
|
13 |
+
*.pywz
|
src/streamlit_app.py β app.py
RENAMED
@@ -3,7 +3,7 @@ import cv2
|
|
3 |
import numpy as np
|
4 |
import streamlit as st
|
5 |
from streamlit_webrtc import webrtc_streamer
|
6 |
-
from opencv_utils import OpenCVUtils
|
7 |
|
8 |
st.set_page_config(page_title="OpenCV Explorer", page_icon="π¨", layout="wide")
|
9 |
|
|
|
3 |
import numpy as np
|
4 |
import streamlit as st
|
5 |
from streamlit_webrtc import webrtc_streamer
|
6 |
+
from src.opencv_utils import OpenCVUtils
|
7 |
|
8 |
st.set_page_config(page_title="OpenCV Explorer", page_icon="π¨", layout="wide")
|
9 |
|
run.py
DELETED
@@ -1,42 +0,0 @@
|
|
1 |
-
#!/usr/bin/env python3
|
2 |
-
import argparse
|
3 |
-
import os
|
4 |
-
import subprocess
|
5 |
-
import sys
|
6 |
-
from pathlib import Path
|
7 |
-
|
8 |
-
|
9 |
-
def main():
|
10 |
-
"""
|
11 |
-
Main function to run the appropriate GUI application based on command-line arguments.
|
12 |
-
"""
|
13 |
-
parser = argparse.ArgumentParser(description="OpenCV GUI Application Launcher")
|
14 |
-
parser.add_argument(
|
15 |
-
"-i",
|
16 |
-
"--interface",
|
17 |
-
choices=["tkinter", "streamlit"],
|
18 |
-
default="tkinter",
|
19 |
-
help="Choose the interface to run (tkinter or streamlit)",
|
20 |
-
)
|
21 |
-
|
22 |
-
args = parser.parse_args()
|
23 |
-
|
24 |
-
# Get the absolute path to the src directory
|
25 |
-
current_dir = Path(__file__).parent
|
26 |
-
src_dir = current_dir / "src"
|
27 |
-
|
28 |
-
if args.interface == "tkinter":
|
29 |
-
print("Starting Tkinter interface...")
|
30 |
-
# Run the tkinter application directly using Python
|
31 |
-
tkinter_path = src_dir / "tkinter_app.py"
|
32 |
-
subprocess.run([sys.executable, str(tkinter_path)])
|
33 |
-
|
34 |
-
elif args.interface == "streamlit":
|
35 |
-
print("Starting Streamlit interface...")
|
36 |
-
# Run the streamlit application using the streamlit CLI
|
37 |
-
streamlit_path = src_dir / "streamlit_app.py"
|
38 |
-
subprocess.run(["streamlit", "run", str(streamlit_path)])
|
39 |
-
|
40 |
-
|
41 |
-
if __name__ == "__main__":
|
42 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/opencv_utils.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
import cv2
|
2 |
import numpy as np
|
3 |
|
4 |
-
from hand_tracker import HandTracker
|
5 |
-
from face_mesh_tracker import FaceMeshTracker
|
6 |
|
7 |
|
8 |
class OpenCVUtils:
|
|
|
1 |
import cv2
|
2 |
import numpy as np
|
3 |
|
4 |
+
from src.hand_tracker import HandTracker
|
5 |
+
from src.face_mesh_tracker import FaceMeshTracker
|
6 |
|
7 |
|
8 |
class OpenCVUtils:
|