Dan Biagini commited on
Commit
6d4cc80
·
1 Parent(s): 1b2b224

working based with multipage nav

Browse files
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ .venv/
README.md CHANGED
@@ -5,8 +5,20 @@ colorFrom: blue
5
  colorTo: indigo
6
  sdk: streamlit
7
  sdk_version: 1.38.0
8
- app_file: app.py
9
  pinned: false
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  colorTo: indigo
6
  sdk: streamlit
7
  sdk_version: 1.38.0
8
+ app_file: Home.py
9
  pinned: false
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
13
+
14
+
15
+ ## Dev install virtual environment -- python 3.11.5
16
+ ```python -m venv .venv```
17
+ ```source .venv/bin/activate```
18
+
19
+ ## Update requirements.txt
20
+ ```pip freeze > requirements.txt```
21
+
22
+ ## Manual Testing
23
+ To run in google cloud shell:
24
+ ```streamlit run src/app.py --browser.serverAddress 8501-$WEB_HOST --browser.serverPort 80```
app.py DELETED
@@ -1,4 +0,0 @@
1
- import streamlit as st
2
-
3
- x = st.slider('Select a value')
4
- st.write(x, 'squared is', x * x)
 
 
 
 
 
src/About.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ import logging
4
+
5
+ st.set_page_config(page_title='About TopShelf', layout="wide",
6
+ page_icon="🥅")
7
+
8
+ st.title('Welcome To Top Shelf :goal_net:',
9
+ help=':video_camera: + :ice_hockey_stick_and_puck: = :clipboard:')
10
+ st.subheader('Artificial Intelligence for Hockey Coaches and Players',
11
+ help='Proof of concept application')
12
+
13
+ overview = '''**Top Shelf** helps coaches and players analyze their gameplay, providing helpful suggestions on areas for improvement.
14
+
15
+ The secret behind **Top Shelf** is *Computer Vision* AI technology that recognizes various hockey related objects in videos.
16
+ This model can recognize players, nets, referees, rink markings and more.
17
+
18
+ **Top Shelf** uses this technology to analyze game play and provide insightful suggestions on areas for improvement.
19
+ '''
20
+ st.markdown(overview)
src/Hockey_Breeds.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ import logging
4
+
5
+ st.set_page_config(page_title='Hockey Breeds', layout="wide",
6
+ page_icon=":frame_with_picture:")
7
+
8
+ st.title('Hockey Breeds - Proof of Concept')
9
+
10
+ st.subheader('Image Classification',
11
+ help='Proof of concept application')
12
+
13
+ img_class = '''Image Classification in Computer Vision is the act of determining the most appropriate label for an entire image from a set of fixed labels.
14
+ A popular topic of image classification in Computer Vision introductions and courses is to use an example problem of training a model to label images of various pet breeds.
15
+ *Hockey Breeds* is a hockey slant on this common theme in Computer Vision educational materials.'''
16
+
17
+ st.markdown(img_class)
18
+
19
+ st.subheader("Hockey Image Classification")
20
+ desc = '''This "Hockey Breeds" model was built using 50 hockey related images found on the web and in my own collection. I started with a pretrained *ResNet18* model (resnet18 is trained on *ImageNet*, a very large dataset with millions of images). I fine tuned the model by labeling the hockey photos, then training using python (*Fast.ai* & *PyTorch* libraries).
21
+
22
+ The total training time for this was approximately 5 minutes running on a low-end GPU. It’s impressive how accurate this quick / small model can be!'''
23
+
24
+ st.markdown(desc)
25
+
26
+ st.subheader("Validation Results")
27
+ st.markdown('Validation of the model\'s performance was done using 26 images not included in the training set. The model performed fairly well against the validation dataset, with only 1 misclassified image.')
28
+ st.image("src/images/samples/confusion_matrix.png", caption="Confusion Matrix for Hockey Breeds ")
29
+
src/Home.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ import logging
4
+
5
+ st.set_page_config(page_title='TopShelf POC', layout="wide",
6
+ page_icon="🥅")
7
+
8
+ st.title('Welcome To Top Shelf :goal_net:',
9
+ help=':video_camera: + :ice_hockey_stick_and_puck: = :clipboard:')
10
+ st.subheader('Artificial Intelligence for Hockey Coaches and Players',
11
+ help='Proof of concept application')
12
+
13
+ overview = '''**Top Shelf** helps coaches and players analyze their gameplay, providing helpful suggestions on areas for improvement.
14
+
15
+ We're starting with a focus on ice hockey, however this same technology could apply to other "invasion" games and sports, for example lacrosse, basketball, soccer, etc.
16
+
17
+ The special sauce behind **Top Shelf** is AI *Computer Vision* technology that recognizes various hockey related objects in videos.
18
+ The foundation of the technology is an AI model that can recognize players, nets, referees, pucks, and rink areas.
19
+
20
+ **Top Shelf** uses this technology to analyze game play and provide insightful suggestions on areas for improvement.
21
+ '''
22
+ st.markdown(overview)
23
+
24
+ st.subheader('Getting Started')
25
+ st.markdown('''We're currently in the training and testing phase of **Top Shelf** development. This is a proof of concept application that friends of **Top Shelf** can use to help in development.
26
+ To help us understand how our *Computer Vision* model is working you can upload hockey pictures and then the app will display what hockey objects were found. ''')
src/app.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ import logging
4
+
5
+ app = st.navigation(
6
+ {"App": [st.Page("Home.py", title="Home", icon=":material/home:"),
7
+ st.Page("About.py", icon="🥅")],
8
+ "Models": [st.Page("Hockey_Breeds.py", icon=":material/gradient:"),
9
+ st.Page("hockey_object_detection.py", title="Hockey Object Detection", icon=":material/filter_b_and_w:")]
10
+ }
11
+ )
12
+ app.run()
src/hockey_object_detection.py ADDED
File without changes
src/images/samples/confusion_matrix.png ADDED